Skip to content

Commit

Permalink
feat(Server): pretty custom error inspect
Browse files Browse the repository at this point in the history
  • Loading branch information
hans00 committed Jul 29, 2022
1 parent 01303cf commit ad7357e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/server/js/errors.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const util = require('util')

module.exports = class ServerError extends Error {
constructor (options = {}) {
super()
Expand All @@ -21,4 +23,8 @@ module.exports = class ServerError extends Error {
return `ServerError: ${this.code}: ${this.message}`
}
}

[util.inspect.custom] () {
return `[${this.code}] ${this.message || (this.originError && this.originError.message) || 'Unknown Error'}`
}
}

0 comments on commit ad7357e

Please sign in to comment.