We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f7d8a5f commit d5b2cc3Copy full SHA for d5b2cc3
src/vendored/chartjs-node-canvas/src/index.ts
@@ -110,17 +110,17 @@ export class ChartJSNodeCanvas {
110
return reject(new Error('Canvas is null'));
111
}
112
const canvas = chart.canvas as Canvas;
113
- canvas.toDataURL(mimeType, (error: Error | null, png: string) => {
+ try {
114
+ const png = canvas.toDataURL(mimeType, 1);
115
chart.platform.releaseContext(chart.ctx);
116
(<any>chart).canvas = null;
117
(<any>chart).ctx = null;
118
119
chart.destroy();
- if (error) {
120
- return reject(error);
121
- }
122
return resolve(png);
123
- });
+ } catch (error) {
+ return reject(error);
+ }
124
});
125
126
0 commit comments