ToolJet/plugins/packages/common/lib/query.error.ts
Kushagra Srivastava 43ac4f251f
add metadata to QueryError and populating metadata in inspector on error (#12501)
* add metadata to QueryError

Signed-off-by: thesynthax <kushagra1403@gmail.com>

* add TODO, minor changes

Signed-off-by: thesynthax <kushagra1403@gmail.com>

* minor changes

Signed-off-by: thesynthax <kushagra1403@gmail.com>

* metadata gets populated on query error/failure

Signed-off-by: thesynthax <kushagra1403@gmail.com>

* add headers to metadata.response

Signed-off-by: thesynthax <kushagra1403@gmail.com>

* redact headers

Signed-off-by: thesynthax <kushagra1403@gmail.com>

---------

Signed-off-by: thesynthax <kushagra1403@gmail.com>
2025-04-28 10:08:34 +05:30

27 lines
787 B
TypeScript

export class QueryError extends Error {
data: Record<string, unknown>;
description: any;
metadata?: unknown;
constructor(message: string | undefined, description: unknown, data: Record<string, unknown>, metadata?: unknown) {
super(message);
this.name = this.constructor.name;
this.data = data;
this.description = description;
this.metadata = metadata;
console.log(this.description);
}
}
export class OAuthUnauthorizedClientError extends Error {
data: Record<string, unknown>;
description: any;
constructor(message: string | undefined, description: any, data: Record<string, unknown>) {
super(message);
this.name = this.constructor.name;
this.data = data;
this.description = description;
console.log(this.description);
}
}