-
Notifications
You must be signed in to change notification settings - Fork 196
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
Improved resilience of formatter_for
#738
Improved resilience of formatter_for
#738
Conversation
It's possible that the call to `Mix.Tasks.Format.formatter_for_file` can cause a compile or syntax errors. Because these types of errors don't have a `message` key, the attempt to log them will fail, and the server will crash. This PR uses `Exception.message` to build the message text, which should work on any exceptions.
@lukaszsamson With respect to patch: I would have been able to pass an option to The options before me are:
1 is not an option, because that's how we got into this situation I think 3 is the best option because it's a small, focused, high-quality library that makes these types of tests much easier to write, which is a good thing. Careful use of patching allows hard-to-exercise code paths testable with only a few lines. It's also a test-only dependency and has not runtime impact. If you have a better suggestion than patch, I'm all ears. |
formatter_for
formatter_for
OK, I'm convinced that option 3 is the one to go here. Especially if |
yay! Thank you, @lukaszsamson |
@scohen are you aware if |
@lukaszsamson i talked to the author, and it was developed under 1.11 and 1.12, so it should work. If the problem persists, he asked that you open an issue and he’s be happy to help fix it. |
It's also interesting that the error seems to indicate that the patch isn't being applied. |
@lukaszsamson I figured it out, see #749 |
It's possible that the call to
Mix.Tasks.Format.formatter_for_file
can cause a compile or syntax errors. Because these types of errors don't have amessage
key, the attempt to log them will fail, and the server will crash.This PR uses
Exception.message
to build the message text, which should work on any exceptions.