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.
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
Editoast error management #237
base: master
Are you sure you want to change the base?
Editoast error management #237
Changes from 1 commit
07f8a25
e7a15f4
c9bb82d
e670075
c2fbf6a
717e31d
ec3e8d2
f735332
1813559
cb0bf8b
da75bbd
46336d8
ab758a5
db47135
0581f19
3c86cc6
489c7be
c28a470
0e29b95
558e345
5e5a2f8
de611a9
81ffc41
adea77c
3e611c6
f7bb491
accb041
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Do we really need a derive macro?
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.
We could live without it, but having it would make assigning eg. error codes much simpler.
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.
We need for each error:
impl EditoastError for MyError
(moderately tedious to write by hand)impl utoipa::ToSchema for MyError
(absolutely insane to write by hand)If that's not convincing enough, manually implementing
EditoastError for
would really hinder the readability of the type. With the macro, all information about an error is gathered around its variant, but it will be scattered across all associated functions in theimpl
block.I believe we're well above the threshold of acceptable boilerplate to justify the complexity of a proc macro ^^
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.
accb041
(#237)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.
This section is not entirely clear to me. Why do we need something since:
thiserror::Error
and therefore implementsDisplay
Serialize
based onDisplay
#[error(transparent)]
basically forward theDisplay
implementation to the sub-errorThere 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.
As said in #237 (comment),
Serialize
doesn't produce the right format. We need to create for eachViewError
that's being returned by an endpoint an instance ofInternalError
. NeitherDisplay
norSerialize
provide enough information for that. (And we're not even speaking about the OpenAPI schemas…)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.
accb041
(#237)