Skip to content

feat: pretty errors with code snippets#5816

Open
christoph-dfinity wants to merge 20 commits intomasterfrom
christoph/grace-errors
Open

feat: pretty errors with code snippets#5816
christoph-dfinity wants to merge 20 commits intomasterfrom
christoph/grace-errors

Conversation

@christoph-dfinity
Copy link
Contributor

@christoph-dfinity christoph-dfinity commented Feb 3, 2026

image

Turned off by default for now, can be turned on by setting the repurposed --print-source-on-error flag.

Implementation

Uses the grace library to pretty print snippets with markers and annotations.

Extends our diagnostics type with spans and notes taking inspiration from https://rustc-dev-guide.rust-lang.org/diagnostics.html

I'd like to get this infrastructure in place first, and then incrementally make use of the spans to improve our existing errors. Once we're happy we can then flip the default for our human users.

Uses the grace library to pretty print snippets with markers and annotations
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Comparing from b2856ed to 07dc1f2:
The produced WebAssembly code seems to be completely unchanged.
In terms of gas, no changes are observed in 5 tests.
In terms of size, no changes are observed in 5 tests.

@christoph-dfinity christoph-dfinity marked this pull request as ready for review February 10, 2026 15:50
@christoph-dfinity christoph-dfinity requested a review from a team as a code owner February 10, 2026 15:50
Copy link
Contributor

@Kamirus Kamirus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a small suggestion

Copy link
Contributor

@Kamirus Kamirus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the --error-format flag?

@christoph-dfinity
Copy link
Contributor Author

Sorry it took me a while, but I finally got back to this. I think I made the changes we discussed last week. PTAL @Kamirus

Copy link
Contributor

@Kamirus Kamirus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@christoph-dfinity christoph-dfinity enabled auto-merge (squash) February 16, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants