Files
redash/client/app/components/app-view/error-handler.js
Arik Fraimovich 56d3be2248 Prettier all the Javascript code & GitHub Action (#4433)
* 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
2019-12-11 17:05:38 +02:00

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;
}
}
}