28 lines
627 B
JavaScript
28 lines
627 B
JavaScript
export class PSQLAdapterError extends Error {
|
|
constructor(response) {
|
|
if (response.hasOwnProperty("message")) {
|
|
super(response.message);
|
|
} else {
|
|
super();
|
|
}
|
|
if (response.hasOwnProperty("name")) {
|
|
this.name = response.name;
|
|
} else {
|
|
this.name = "PSQLAdapterError";
|
|
}
|
|
if (response.hasOwnProperty("trace")) {
|
|
this.trace = response.trace;
|
|
}
|
|
}
|
|
|
|
toString() {
|
|
let str = this.name;
|
|
if (this.hasOwnProperty("message")) {
|
|
str += ": " + this.message;
|
|
}
|
|
if (this.hasOwnProperty("trace")) {
|
|
str += "\n" + this.trace;
|
|
}
|
|
return str;
|
|
}
|
|
} |