Skip to content

Better migration errors#640

Open
patricoferris wants to merge 1 commit into
ocaml-ppx:mainfrom
patricoferris:migration-errors
Open

Better migration errors#640
patricoferris wants to merge 1 commit into
ocaml-ppx:mainfrom
patricoferris:migration-errors

Conversation

@patricoferris
Copy link
Copy Markdown
Collaborator

@patricoferris patricoferris commented Apr 22, 2026

The new error messages provide more context and make sure to mention that ppxlib raised the error. My Format-knowledge is not great so perhaps there is something better than pp_print_text. Also, very happy to discuss what the "better error messages" should be @NathanReb !

Part of improving #626

The new error messages provide more context and make sure to mention
that ppxlib raised the error.

Signed-off-by: Patrick Ferris <patrick@sirref.org>
@patricoferris patricoferris changed the title Migration errors Better migration errors Apr 22, 2026
Copy link
Copy Markdown
Collaborator

@NathanReb NathanReb left a comment

Choose a reason for hiding this comment

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

Looks good to me! Only have a minor suggestions on the decoding failure message.

The formatting looks good enough to me, we can always improve it later on.

Comment thread astlib/error.ml
Format.sprintf
"ppxlib invalid encoding: %s\n\n\
Ppxlib failed to decode a feature from the OCaml %s AST. If this does \
not seem right, please do open an issue at \
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

How about also hinting at an interaction between the language feature and a ppx here?
Something along those lines:

This is likely caused by the use of a 5.3+ language feature within code directly interpreted by a ppx.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe even add something like:

If you'd like this feature to be supported by the ppx involved, please reach out to the ppx maintainers.
If this does not seem right, please do open an issue at...

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