diff --git a/src/Logger.js b/src/Logger.js index f75d60c..e912883 100644 --- a/src/Logger.js +++ b/src/Logger.js @@ -17,4 +17,14 @@ export default class Logger { [Date.now() - this.start + 'ms', 'html2canvas:'].concat([].slice.call(args, 0)) ); } + + // eslint-disable-next-line flowtype/no-weak-types + error(...args: any) { + Function.prototype.bind + .call(window.console.error, window.console) + .apply( + window.console, + [Date.now() - this.start + 'ms', 'html2canvas:'].concat([].slice.call(args, 0)) + ); + } } diff --git a/src/index.js b/src/index.js index a594653..8af8bc3 100644 --- a/src/index.js +++ b/src/index.js @@ -51,7 +51,7 @@ const html2canvas = (element: HTMLElement, config: Options): Promise { + logger.error(e); + throw e; + }); + } + return result; }; module.exports = html2canvas;