PawSQLite/src/adapters/cordova_pawsqlite/psql_adapter_error.mjs
2021-03-01 18:47:07 -08:00

31 lines
698 B
JavaScript

import { PawSQLiteError } from "../../pawsqlite_error.mjs";
export class PSQLAdapterError extends PawSQLiteError {
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;
}
}