Skip to content

Commit

Permalink
fix: pass only error message to nested error
Browse files Browse the repository at this point in the history
  • Loading branch information
just-paja committed Feb 1, 2023
1 parent 58f0540 commit 521e9af
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/djorm/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ class NestedValidationError extends ValueError {

constructor (fieldErrors) {
super('Invalid request')
if (fieldErrors.length === 1) {
this.message = fieldErrors[0].message
this.stack = fieldErrors[0].stack
}
this.fieldErrors = fieldErrors.filter(e => e instanceof FieldError)
this.processingError = fieldErrors.find(e => !(e instanceof FieldError))
}
Expand Down

0 comments on commit 521e9af

Please sign in to comment.