Add description to NodeOperationError (#2148)

This commit is contained in:
Iván Ovejero 2021-08-31 10:49:55 +02:00 committed by GitHub
parent 1dfebf0363
commit 57025a7b79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -202,11 +202,15 @@ abstract class NodeError extends Error {
* Class for instantiating an operational error, e.g. an invalid credentials error.
*/
export class NodeOperationError extends NodeError {
constructor(node: INode, error: Error | string) {
constructor(node: INode, error: Error | string, options?: { description: string }) {
if (typeof error === 'string') {
error = new Error(error);
}
super(node, error);
if (options?.description) {
this.description = options.description;
}
}
}