-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Embed errors in the AST instead of raising #29
Comments
IMO this makes sense to have, and I can offer myself to review the change in case @roddyyaga isn't available. |
Hey, that sounds great, happy to review. |
Thanks a lot for the reviewing offer! Note that we decided that we will change the ppxlib behaviour regarding the handling of exceptions, to match the current use of However, embedding errors still have advantages: It allows reporting multiple errors, while still outputting valid AST for the part that were successful. In the case of this PPX, an example where embedding errors is better could written as: let many_arg_execute =
[%rapper
execute
{sql|
UPDATE users
SET (username, email, bio) = (%invalid1{username}, %invalid2{email}, %string{bio})
|sql}]
which, when raising instead of embedding errors, would not list both errors (both |
Hi senior! |
I would like to work on this issue along with @marrious11 please. |
You can of course work together on this issue if you want! Bear in mind that at the end of the Outreachy contribution period, I will be only able to accept one applicant, and it might be harder for me to distinguish between people who have worked together. (If @marrious11 prefers to work alone, I would say the issue is assigned to them as they were first to ask for an assignment!) |
Hi sir @panglesd, happy new month. Finally, according to the README.md: How do I add these line |
Hi @marrious11, |
Hello @marrious11,
The error is telling you that the caqti-type-calendar library is not found. This is because some of the dependencies have not been installed. In order to install the dependencies of a project you want to work on, the best is to run:
Running Since you want to work on
The README mention how to use |
Thank you sir @panglesd, it worked. No errors generated again. |
Currently, when
ppx_rapper
encounters an error, it uses theraise_errorf
function to raise a located error.The exception is caught by
ppxlib
, which in this case:[%%%ocaml.error ...]
extension node) to the last valid astThe interruption of the rewriting is quite bad for the user experience! The implication for the users are:
ppx_rapper
runs at the "context-free" phase, the "last valid AST" is before the context-free phase. So, no other derivers/extenders get run, which generates a lot of noise in the errors (such as "uninterpreted extensions" or "unbound identifiers")Example
For instance:
would report several errors:
Error in ppx_rapper: Supported actions are [...]
forinvalid1
(the right error)for
invalid1,
invalid2and
valid`.The right error for
invalid2
is not shown, and the "uninterpreted extension" errors add a lot of noise!You can find more information about error reporting in PPXs in this section of the ppxlib manual.
❓ Would you be willing to accept contributions to this issue? I'm considering assigning its resolution as part of an outreachy internship: see more information here.
The text was updated successfully, but these errors were encountered: