mirror of
https://github.com/getredash/redash.git
synced 2025-12-19 17:37:19 -05:00
* Prettier all the JS files * Add GitHub Action to autoformat code pushed to master * Fix eslint violation due to formatting. * Remove GitHub actions for styling * Add restyled.io config
26 lines
545 B
JavaScript
26 lines
545 B
JavaScript
import PromiseRejectionError from "@/lib/promise-rejection-error";
|
|
|
|
// eslint-disable-next-line import/prefer-default-export
|
|
export class ErrorHandler {
|
|
constructor() {
|
|
this.logToConsole = true;
|
|
this.reset();
|
|
}
|
|
|
|
reset() {
|
|
this.error = null;
|
|
}
|
|
|
|
process(error) {
|
|
this.reset();
|
|
if (this.logToConsole) {
|
|
// Log raw error object
|
|
// eslint-disable-next-line no-console
|
|
console.error(error);
|
|
}
|
|
if (error === null || error instanceof PromiseRejectionError) {
|
|
this.error = error;
|
|
}
|
|
}
|
|
}
|