diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index 101c7c62bb..17db12fc8b 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -9,6 +9,7 @@ - Latex now includes Mathjax's ASM extension for more powerful Latex functionality [#1544](https://github.com/terrastruct/d2/pull/1544) - `font-color` works on Markdown [#1546](https://github.com/terrastruct/d2/pull/1546) - `font-color` works on arrowheads [#1582](https://github.com/terrastruct/d2/pull/1582) +- CLI failure message includes input path [#1617](https://github.com/terrastruct/d2/pull/1617) #### Bugfixes ⛑️ diff --git a/d2cli/main.go b/d2cli/main.go index 546a5a977b..56aed09e9f 100644 --- a/d2cli/main.go +++ b/d2cli/main.go @@ -334,9 +334,9 @@ func Run(ctx context.Context, ms *xmain.State) (err error) { _, written, err := compile(ctx, ms, plugins, layoutFlag, renderOpts, fontFamily, *animateIntervalFlag, inputPath, outputPath, "", *bundleFlag, *forceAppendixFlag, pw.Page) if err != nil { if written { - return fmt.Errorf("failed to fully compile (partial render written): %w", err) + return fmt.Errorf("failed to fully compile (partial render written) %s: %w", ms.HumanPath(inputPath), err) } - return fmt.Errorf("failed to compile: %w", err) + return fmt.Errorf("failed to compile %s: %w", ms.HumanPath(inputPath), err) } return nil }