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

Introduce '--show-backtrace' to show backtrace on compile error #4652

Conversation

makenowjust
Copy link
Contributor

On compiler development, we want to see exception's backtrace sometime. This option is for it.

On compiler development, we want to see exception's backtrace sometime.
This option is for it.
@@ -118,7 +119,16 @@ class Crystal::Command
if @config.try(&.output_format) == "json"
puts ex.to_json
else
puts ex
if @show_backtrace
puts ex
Copy link
Contributor

Choose a reason for hiding this comment

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

ex.inspect_with_backtrace(STDERR)?

Copy link
Contributor Author

@makenowjust makenowjust Jul 1, 2017

Choose a reason for hiding this comment

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

No. inspect_with_backtrace uses ex.message, but full error message of Crystal::Exception is built by to_s method. So if use inspect_with_backtrace, we can't see full error message.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair 'nuff, and what about printing errors into STDERR instead of STDOUT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When #4494 is merged, I'll do it.

@asterite
Copy link
Member

asterite commented Jul 1, 2017

On compiler errors you write a spec, it fails and then you see the backtrace. Plus on a released compiler the backtrace will not be accurate because of --release.

@makenowjust
Copy link
Contributor Author

@asterite Yes. You are right.

@makenowjust makenowjust closed this Jul 1, 2017
@makenowjust makenowjust deleted the feature/crystal/show-backtrace branch August 7, 2017 04:49
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.

3 participants