Add InvocationError for an error without traceback. Log cancel at info. #157
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This needs testing before merge
This fixes two related things:
1. Events being cancelled by the user are logged as errors.
While error handling is used for cancelling the event. From the user's perspective no error happened. They asked for it to be cancelled, and it was. This PR changes that log to "Info", so that the event is logged, but the user isn't notified of an error for expected behaviour.
2. Adds a new exception type without a traceback.
Currently any unhandled errors are shown with an ASGI traceback. Very useful for developers, but not friendly for the end user. These make sense for unknown errors.In the OpenFlexure Microscope we handle this by catching errors, logging the error and then exiting. This does not notify as an error on exit correctly unless they go to the log. However a full ASGI error traceback doesn't communicate the message needed.This should create an error type that ends the invocation, logs without traceback, but creates the correct error response when the invocation completes.Hmm, no they are not always ASGI errors. But, it still seems like a good idea for an action to be able to communicate "I handled this error, but I am stopping" and for this to be treated differently to an unhandled exception in an action.