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

Graceful error handling in soltest/isoltest + improved soltestAssert() #12283

Merged
merged 7 commits into from
Apr 7, 2022

Conversation

cameel
Copy link
Member

@cameel cameel commented Nov 15, 2021

Fixes #11917.

While working on #12282 I hit an assertion in ByteUtils but it looked like something completely different. That's because soltestAssert() throws std::runtime_error rather than some special exception type reserved for assertions. I also noticed that in #12019 I did not cover soltestAssert(). This PR refactors the macro to be in line with solAssert(), i.e. allow skipping the message, provide a default message and use a dedicated exception type.

I have also added exception handlers that intercept normal errors (like command-line validation errors) and print them in a way that does not make you think you hit a bug.

Also, --help no longer returns an error code. It's normal and expected behavior. A similar change was made for solc in #12118.

I recommend reviewing with the option to ignore whitespace changes enabled - changes are actually small but some blocks had to be reindented due to the added try/catch.

@cameel cameel self-assigned this Nov 15, 2021
@cameel cameel force-pushed the soltest-graceful-error-handling branch 2 times, most recently from 2ff6cfd to a970f9f Compare November 15, 2021 17:22
@cameel cameel force-pushed the soltest-graceful-error-handling branch from a970f9f to 8f692a6 Compare November 30, 2021 13:27
Marenz
Marenz previously approved these changes Dec 2, 2021
@cameel cameel force-pushed the soltest-graceful-error-handling branch from 8f692a6 to eab8b3a Compare December 6, 2021 17:38
@cameel cameel force-pushed the soltest-graceful-error-handling branch from eab8b3a to 8de47e6 Compare December 16, 2021 16:37
@cameel
Copy link
Member Author

cameel commented Dec 16, 2021

Rebased on develop to have the CI pass.

@cameel cameel force-pushed the soltest-graceful-error-handling branch from 8de47e6 to 0bb2050 Compare December 20, 2021 19:23
@leonardoalt
Copy link
Member

Has conflicts

@leonardoalt
Copy link
Member

Still has conflicts.

@cameel
Copy link
Member Author

cameel commented Apr 4, 2022

Just needs a rebase (and another look from @christianparpart :)). Otherwise it should be fine.

Copy link
Member

@christianparpart christianparpart left a comment

Choose a reason for hiding this comment

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

LGTM, apart from the very minors. :)

@cameel cameel force-pushed the soltest-graceful-error-handling branch from 0bb2050 to b3048cc Compare April 6, 2022 20:27
@cameel cameel requested a review from christianparpart April 6, 2022 20:29
@cameel
Copy link
Member Author

cameel commented Apr 6, 2022

Ready for another round of review.

Copy link
Member

@christianparpart christianparpart left a comment

Choose a reason for hiding this comment

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

great. thanks. :-)

@christianparpart christianparpart merged commit e74f030 into develop Apr 7, 2022
@christianparpart christianparpart deleted the soltest-graceful-error-handling branch April 7, 2022 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[soltest] Command-line validation errors should not look like an ICE
4 participants