-
Notifications
You must be signed in to change notification settings - Fork 41
feat: add the X-Dragonfly-Error-Type header to the response #1299
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1299 +/- ##
==========================================
- Coverage 48.58% 48.55% -0.04%
==========================================
Files 60 60
Lines 15154 15196 +42
==========================================
+ Hits 7363 7378 +15
- Misses 7791 7818 +27
🚀 New features to boost your workflow:
|
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.
LG
681cb6a
to
f8641c2
Compare
f8641c2
to
afc757a
Compare
afc757a
to
f3c8a99
Compare
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
f3c8a99
to
524c871
Compare
Signed-off-by: chlins <chlins.zhang@gmail.com>
524c871
to
e9a40fc
Compare
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.
LGTM
This pull request enhances error handling and reporting throughout the
dragonfly-client
project, focusing on more explicit error typing and improved communication of error sources to clients via HTTP response headers. The main changes include introducing a new error type system, updating error responses to include error source information, and refactoring code to utilize these new mechanisms.Error Type System and Header Reporting:
Added a new
ErrorType
enum indragonfly-client/src/proxy/header.rs
to represent the source of errors (Backend
,Proxy
,Dfdaemon
), along with a corresponding HTTP headerX-Dragonfly-Error-Type
for error responses. This helps clients identify where an error originated.Refactored the
make_error_response
function indragonfly-client/src/proxy/mod.rs
to require anErrorType
argument and to set the error type header in all error responses. All error response creation sites throughout the proxy code were updated to use this new function signature and provide the appropriate error type. [1] [2]Proxy Error Handling Improvements:
Updated proxy handler functions (
http_handler
,https_handler
,upgraded_handler
, andproxy_via_http
) to use the new error type system when returning error responses, ensuring clients can distinguish between proxy, backend, and dfdaemon errors. [1] [2] [3] [4]Enhanced error reporting in
proxy_via_dfdaemon
to set the correct error type in all error response paths, including backend failures, dfdaemon failures, and general errors, improving traceability for clients. [1] [2] [3] [4] [5] [6] [7] [8] [9]Backend Error Propagation:
dragonfly-client-backend/src/http.rs
) to return structured error responses with explicit success flags and error messages, rather than propagating errors viainspect_err
. This makes error handling more robust and consistent. [1] [2] [3]Resource Task Error Handling:
Task
implementation indragonfly-client/src/resource/task.rs
to use the new error response structure, passing through optional status code and header fields directly, improving error information fidelity.Description
Related Issue
Motivation and Context
Screenshots (if appropriate)