-
-
Notifications
You must be signed in to change notification settings - Fork 289
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
fix: make multiple api errors spec compliant #6479
Closed
Closed
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
55f4cd4
Add new MultipleError and update submitPoolAttestations to use it
har777 16611c8
Rename MultipleError to IndexedError + change error message in submit…
har777 a86e85a
Update getErrorMessage to handle failures key
har777 0ad7c21
Update submitPoolBlsToExecutionChange to use IndexedError
har777 e32fb50
Update submitPoolSyncCommitteeSignatures to use IndexedError
har777 0acfc71
Add e2e api tests checking correct handling of IndexedError
har777 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,17 @@ export class OnlySupportedByDVT extends ApiError { | |
super(501, "Only supported by distributed validator middleware clients"); | ||
} | ||
} | ||
|
||
export class MultipleError extends ApiError { | ||
har777 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
failures: {index: number; message: string}[]; | ||
|
||
constructor(message: string, errors: {index: number; error: Error}[]) { | ||
super(400, message); | ||
|
||
const failures = []; | ||
for (const {index, error} of errors) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As noted in other comment, we could just pass failures in as is to avoid this conversion from array of errors to correct failures format. Slight UX improvement we should consider is sorting the failures by index as order is not guaranteed due to the async processing. |
||
failures.push({index: index, message: error.message}); | ||
} | ||
this.failures = failures; | ||
} | ||
} |
This file contains 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
Oops, something went wrong.
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.
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.
Since this is not a plain array of errors anymore, we could consider just tracking failures here directly as we log the errors (incl. stack trace) separately anyways