-
Notifications
You must be signed in to change notification settings - Fork 14
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
Fixes crash when an asset isn't available. #9
Conversation
say "Write asset: #{filename}" | ||
asset.write_to(filename) | ||
end | ||
rescue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will rescue any exception, not just Asset not found
related ones. So if the block fails for any other reason the output will be misleading.
If the idea is to not crash the process when it fails then it should output more details about what went wrong so it's easier to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, it was misleading.
If the idea is to not crash the process when it fails then it should output more details about what went wrong so > it's easier to fix it.
That's the idea. Now I simply print the exception message whenever something is thrown, and add it to a list of warnings to be shown at the end.
What do you think of this approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good - just one thing:
If I'm not mistaken you shouldn't rescue Exception
and use StandardError
instead - otherwise stuff like hitting ctrl+c
or running kill $PID
won't quit the program.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, that would have been nasty. Thanks for pointing it out.
@@ -27,12 +27,25 @@ def build(*assets) | |||
|
|||
say "Building: #{Catapult.root}" | |||
|
|||
warnings = Array.new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool stuff! Can you use [] ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surely. :)
Fixes crash when an asset isn't available.
@maccman Could you push this to rubygems please. Thank you! |
As mentioned in #7, catapult was crashing whenever it didn't find an asset.
This pull request intercepts the exception and issues a warning.