🐛 Fix circular references removal (#1901)

Circular references removed only for the request library error.
This commit is contained in:
Iván Ovejero 2021-06-16 12:41:56 +02:00 committed by GitHub
parent 0b65459f9f
commit e45d173c45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,7 +52,6 @@ abstract class NodeError extends Error {
constructor(node: INode, error: Error | JsonObject) {
super();
this.removeCircularRefs(error as JsonObject);
this.name = this.constructor.name;
this.cause = error;
this.node = node;
@ -215,6 +214,9 @@ export class NodeApiError extends NodeError {
{ message, description, httpCode, parseXml }: { message?: string, description?: string, httpCode?: string, parseXml?: boolean } = {},
) {
super(node, error);
if (error.error) { // only for request library error
this.removeCircularRefs(error.error as JsonObject);
}
if (message) {
this.message = message;
this.description = description;