Add InvocationError for an error without traceback. Log cancel at info.#157
Merged
Add InvocationError for an error without traceback. Log cancel at info.#157
Conversation
Barecheck - Code coverage reportTotal: 93.31%Your code coverage diff: 0.01% ▴ Uncovered files and lines
|
1be3dfe to
fbad976
Compare
c5be363 to
b171f44
Compare
rwb27
approved these changes
Aug 13, 2025
Collaborator
rwb27
left a comment
There was a problem hiding this comment.
This looks good to me.
We need to standardise whether exceptions get re-exported from .exceptions or whether they are defined there and imported where they're needed. The latter would play better with the API docs, but we should standardise this in its own PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.