this.status = status
}
+ // note: Javascript errors return status 400 (Bad request) in the client
+ // version of Problem, 500 (Internal server error) in the server version
static from(error) {
return (
error instanceof Problem ?
error :
- new Problem('Bad request', (error.stack || error.message), 400)
+ new Problem(
+ 'Bad request',
+ (error.stack || error.message),
+ 400
+ )
)
}
}
this.detail = detail
this.status = status
}
+
+ // note: Javascript errors return status 400 (Bad request) in the client
+ // version of Problem, 500 (Internal server error) in the server version
+ static from(error) {
+ return (
+ error instanceof Problem ?
+ error :
+ new Problem(
+ 'Internal server error',
+ (error.stack || error.message),
+ 500
+ )
+ )
+ }
}
return Problem
this.status = status
}
+ // note: Javascript errors return status 400 (Bad request) in the client
+ // version of Problem, 500 (Internal server error) in the server version
static from(error) {
return (
error instanceof Problem ?
error :
- new Problem('Bad request', (error.stack || error.message), 400)
+ new Problem(
+ 'Bad request',
+ (error.stack || error.message),
+ 400
+ )
)
}
}