mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-04-25 12:19:10 +00:00
15 lines
294 B
JavaScript
15 lines
294 B
JavaScript
class RPCError extends Error {
|
|
constructor (msg, code, ...extra) {
|
|
super(msg)
|
|
this.code = code
|
|
this.extra = extra
|
|
}
|
|
|
|
static fromResponse (body, status) {
|
|
const e = new RPCError(body.msg, status)
|
|
e.remoteStack = body.trace
|
|
return e
|
|
}
|
|
}
|
|
|
|
module.exports = RPCError
|