better error messages

This commit is contained in:
Anton Lavrenov 2020-02-25 19:22:46 -05:00
parent 2e40322b83
commit c6e38c55a1
3 changed files with 17 additions and 6 deletions

View File

@ -5,8 +5,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## Not released: ## Not released:
## 4.1.6 - 2020-02-25
* Events fixes for `Konva.Transformer` * Events fixes for `Konva.Transformer`
* Now `Konva` will keep `id` in a cloned node * Now `Konva` will keep `id` in a cloned node
* Better error messages on tainted canvas issues
## 4.1.5 - 2020-02-16 ## 4.1.5 - 2020-02-16

View File

@ -135,7 +135,11 @@ export class Canvas {
try { try {
return this._canvas.toDataURL(); return this._canvas.toDataURL();
} catch (err) { } catch (err) {
Util.error('Unable to get data URL. ' + err.message); Util.error(
'Unable to get data URL. ' +
err.message +
'. For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html.'
);
return ''; return '';
} }
} }

View File

@ -619,7 +619,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
Util.error( Util.error(
'Filter should be type of function, but got ' + 'Filter should be type of function, but got ' +
typeof filter + typeof filter +
' insted. Please check correct filters' ' instead. Please check correct filters'
); );
continue; continue;
} }
@ -627,7 +627,11 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
filterContext.putImageData(imageData, 0, 0); filterContext.putImageData(imageData, 0, 0);
} }
} catch (e) { } catch (e) {
Util.error('Unable to apply filter. ' + e.message); Util.error(
'Unable to apply filter. ' +
e.message +
'. This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.'
);
} }
this._filterUpToDate = true; this._filterUpToDate = true;
@ -2233,9 +2237,9 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
var stopBubble = var stopBubble =
(eventType === MOUSEENTER || eventType === MOUSELEAVE) && (eventType === MOUSEENTER || eventType === MOUSELEAVE) &&
compareShape && compareShape &&
compareShape.isAncestorOf && compareShape.isAncestorOf &&
compareShape.isAncestorOf(this) && compareShape.isAncestorOf(this) &&
!compareShape.isAncestorOf(this.parent); !compareShape.isAncestorOf(this.parent);
if ( if (
((evt && !evt.cancelBubble) || !evt) && ((evt && !evt.cancelBubble) || !evt) &&
this.parent && this.parent &&