Skip to content
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

Fix: Unwrap nested errors in error handler for Crystal::Error #12888

Conversation

straight-shoota
Copy link
Member

This addresses number 2. of #12874 to make sure information about the original error is not being hidden.

$ echo 'require "bar"' > foo.cr
$ echo '{% `filedoesnotexist` %}' > bar.cr
$ crystal build foo.cr
Error: while requiring "./bar"
$ bin\crystal build foo.cr
Error: while requiring "./bar"
Error: Error executing process: 'filedoesnotexist': The system cannot find the file specified.

This is a very simple implementation and probably not the best finished solution that we could find. But it does the job and it enables a basic requirement. Without this change, unexpected errors (such as the File::NotFoundError when a system command fails on Windows, #12874) are basically impossible to debug.

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler labels Dec 31, 2022
@straight-shoota straight-shoota changed the title Fix: Unwrap nested errors in error handler for Crystal::Error' Fix: Unwrap nested errors in error handler for Crystal::Error Dec 31, 2022
@straight-shoota straight-shoota self-assigned this Dec 31, 2022
@beta-ziliani beta-ziliani added this to the 1.7.0 milestone Jan 3, 2023
Copy link
Member

@sdogruyol sdogruyol left a comment

Choose a reason for hiding this comment

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

Thank you @straight-shoota 🙏

@straight-shoota straight-shoota merged commit 939772e into crystal-lang:master Jan 4, 2023
@straight-shoota straight-shoota deleted the fix/compiler-command-error branch January 4, 2023 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants