Added static method for creating PawSQLiteErrors from other errors

This commit is contained in:
Ben Ashton 2021-03-01 22:20:42 -08:00
parent 38df7f1053
commit 7b9095ffa6

View File

@ -1,4 +1,10 @@
export class PawSQLiteError extends Error { export class PawSQLiteError extends Error {
static from(err) {
const p_err = new PawSQLiteError(err.toString());
p_err.cause = err;
return p_err;
}
constructor(message) { constructor(message) {
super(message); super(message);
this.name = "PawSQLiteError"; this.name = "PawSQLiteError";