-
Notifications
You must be signed in to change notification settings - Fork 26
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
Implement error handling #31
Implement error handling #31
Conversation
Signed-off-by: declark1 <daniel.clark@ibm.com>
Signed-off-by: declark1 <daniel.clark@ibm.com>
…ound and return 404, drop is_validation_error helper Signed-off-by: declark1 <daniel.clark@ibm.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the error handling! A few questions
Signed-off-by: declark1 <daniel.clark@ibm.com>
Signed-off-by: declark1 <daniel.clark@ibm.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Signed-off-by: declark1 <daniel.clark@ibm.com>
This PR implements initial error handling using 3 layers of errors:
clients::Error
is a low-level error that wraps grpc and http client errors.status_code()
method to return the actual (http client) or mapped (grpc client) http status code. This is useful for pattern-matching specific types of errors.orchestrator::Error
contains variants for issues that may arise during processing of tasks, such asDetectorNotFound
,DetectorRequestFailed
, etc. We can extend this as-needed.server::Error
is a high-level error returned to the caller, enabling them to react accordingly to validation and not found errors from the orchestrator and downstream services.axum::IntoResponse
to return 422 for validation-type errors (with a detailed message), 404 for not found errors, and 500 (with generic “unexpected error” message) for other errors.orchestrator::Error
to provide sufficient detail for debuggingcreate_http_clients
andcreate_grpc_clients
to panic rather than returnResult
and updatesClient::new
methods andorchestrator::create_clients
accordinglyExamples:
detector_id
provided in requestServer response:
Server response: