Skip to content

Commit

Permalink
Document DEV_SIMPLE_EXCEPTION macro
Browse files Browse the repository at this point in the history
  • Loading branch information
cameel committed Nov 9, 2021
1 parent 19159b9 commit 276d173
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libsolutil/Exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ struct Exception: virtual std::exception, virtual boost::exception
::boost::throw_line(__LINE__) \
)

/// Defines an exception type that's meant to signal a specific condition and be caught rather than
/// unwind the stack all the way to the top-level exception handler and interrupt the program.
/// As such it does not carry a message - the code catching it is expected to handle it without
/// letting it escape.
#define DEV_SIMPLE_EXCEPTION(X) struct X: virtual ::solidity::util::Exception { const char* what() const noexcept override { return #X; } }

DEV_SIMPLE_EXCEPTION(InvalidAddress);
Expand Down

0 comments on commit 276d173

Please sign in to comment.