Adding error field.
This commit is contained in:
parent
f036776a90
commit
c9ec06b5b1
|
@ -43,8 +43,9 @@ class CouchDBError extends Error {
|
||||||
statusCode: number
|
statusCode: number
|
||||||
reason: string
|
reason: string
|
||||||
name: string
|
name: string
|
||||||
errid: string | undefined
|
errid: string
|
||||||
description: string | undefined
|
error: string
|
||||||
|
description: string
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
message: string,
|
message: string,
|
||||||
|
@ -54,6 +55,7 @@ class CouchDBError extends Error {
|
||||||
errid: string
|
errid: string
|
||||||
description: string
|
description: string
|
||||||
reason: string
|
reason: string
|
||||||
|
error: string
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
super(message)
|
super(message)
|
||||||
|
@ -63,6 +65,7 @@ class CouchDBError extends Error {
|
||||||
this.name = info.name
|
this.name = info.name
|
||||||
this.errid = info.errid
|
this.errid = info.errid
|
||||||
this.description = info.description
|
this.description = info.description
|
||||||
|
this.error = info.error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,13 +171,7 @@ export class DatabaseImpl implements Database {
|
||||||
return await this.performCall(call)
|
return await this.performCall(call)
|
||||||
}
|
}
|
||||||
// stripping the error down the props which are safe/useful, drop everything else
|
// stripping the error down the props which are safe/useful, drop everything else
|
||||||
throw new CouchDBError(`CouchDB error: ${err.message}`, {
|
throw new CouchDBError(`CouchDB error: ${err.message}`, err)
|
||||||
status: err.status || err.statusCode,
|
|
||||||
name: err.name,
|
|
||||||
errid: err.errid,
|
|
||||||
description: err.description,
|
|
||||||
reason: err.reason,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue