Skip to content

Commit

Permalink
Catch exception in web canvas
Browse files Browse the repository at this point in the history
If special method exists - let provide it
  • Loading branch information
linev committed Sep 13, 2024
1 parent 4ec0600 commit cb0ea6c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/gpad/RCanvasPainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,12 @@ class RCanvasPainter extends RPadPainter {
this.addPadInteractive();
handle.send(`SNAPDONE:${snapid}`); // send ready message back when drawing completed
this.confirmDraw();
});
}).catch(err => {
if (isFunc(this.showConsoleError))
this.showConsoleError(err);
else
console.log(err);
});
} else if (msg.slice(0, 4) === 'JSON') {
const obj = parse(msg.slice(4));
// console.log('get JSON ', msg.length-4, obj._typename);
Expand Down
5 changes: 5 additions & 0 deletions modules/gpad/TCanvasPainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@ class TCanvasPainter extends TPadPainter {
if (ranges) ranges = ':' + ranges;
handle.send(`READY6:${version}${ranges}`); // send ready message back when drawing completed
this.confirmDraw();
}).catch(err => {
if (isFunc(this.showConsoleError))
this.showConsoleError(err);
else
console.log(err);
});
} else if (msg.slice(0, 5) === 'MENU:') {
// this is menu with exact identifier for object
Expand Down

0 comments on commit cb0ea6c

Please sign in to comment.