-
Notifications
You must be signed in to change notification settings - Fork 6.2k
[solc] Exit code 2 for exceptions. #13633
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ int main(int argc, char** argv) | |
|
||
std::cerr << std::endl; | ||
std::cerr << "ERROR: " << exception.what() << std::endl; | ||
return 1; | ||
return 2; | ||
} | ||
catch (solidity::phaser::BadInput const& exception) | ||
{ | ||
|
@@ -45,46 +45,12 @@ int main(int argc, char** argv) | |
|
||
std::cerr << std::endl; | ||
std::cerr << "ERROR: " << exception.what() << std::endl; | ||
return 1; | ||
} | ||
catch (solidity::util::Exception const& exception) | ||
{ | ||
// Something's seriously wrong. Probably a bug in the program or a missing handler (which | ||
// is really also a bug). The exception should have been handled gracefully by this point | ||
// if it's something that can happen in normal usage. E.g. an error in the input or a | ||
// failure of some part of the system that's outside of control of the application (disk, | ||
// network, etc.). The bug should be reported and investigated so our job here is just to | ||
// provide as much useful information about it as possible. | ||
|
||
std::cerr << std::endl; | ||
std::cerr << "UNCAUGHT EXCEPTION!" << std::endl; | ||
|
||
// We can print some useful diagnostic info for this particular exception type. | ||
std::cerr << "Location: " << exception.lineInfo() << std::endl; | ||
|
||
char const* const* function = boost::get_error_info<boost::throw_function>(exception); | ||
if (function != nullptr) | ||
std::cerr << "Function: " << *function << std::endl; | ||
|
||
// Let it crash. The terminate() will print some more stuff useful for debugging like | ||
// what() and the actual exception type. | ||
throw; | ||
} | ||
catch (std::exception const&) | ||
{ | ||
// Again, probably a bug but this time it's just plain std::exception so there's no point | ||
// in doing anything special. terminate() will do an adequate job. | ||
std::cerr << std::endl; | ||
std::cerr << "UNCAUGHT EXCEPTION!" << std::endl; | ||
throw; | ||
return 2; | ||
} | ||
catch (...) | ||
{ | ||
// Some people don't believe these exist. | ||
// I have no idea what this is and it's flying towards me so technically speaking it's an | ||
// unidentified flying object. | ||
std::cerr << std::endl; | ||
std::cerr << "UFO SPOTTED!" << std::endl; | ||
throw; | ||
std::cerr << "Uncaught exception:" << std::endl; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any particular reason why we're not using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, if we have two consecutive stream writes, it would make more sense to append a newline, i.e. |
||
std::cerr << boost::current_exception_diagnostic_information() << std::endl; | ||
return 2; | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.