Skip to content

Propagating Exceptions in Interactive Shell #2055

Answered by remkop
irinaleo asked this question in Q&A
Discussion options

You must be logged in to vote

The execute method catches all exceptions, that is the intention.

One idea is to have custom exception handlers:
Generally there are 2 types of errors: invalid user input and the application throwing an exception in its business logic.
There are separate IParameterExceptionHandler and IExecutionExceptionHandler interfaces for these.

You could have a custom IExecutionExceptionHandler that preserves the exception thrown by the business logic (in addition to printing a stack trace and returning a non-zero error code). The test code could then inspect whether the caught and preserved exception matches the expectation.

Alternatively you could do "black box" testing and inspect the Standard Err…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@irinaleo
Comment options

Answer selected by irinaleo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants