From 078b23f78a0885bbc2ced836ed8d0d8bbbbf66bc Mon Sep 17 00:00:00 2001 From: Asturur Date: Mon, 26 Dec 2016 19:12:22 +0100 Subject: [PATCH 1/2] send error to reviver --- src/util/misc.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/util/misc.js b/src/util/misc.js index 7b74fc69676..78a3b378f81 100644 --- a/src/util/misc.js +++ b/src/util/misc.js @@ -328,10 +328,8 @@ var klass = fabric.util.getKlass(o.type, namespace); if (klass.async) { klass.fromObject(o, function (obj, error) { - if (!error) { - enlivenedObjects[index] = obj; - reviver && reviver(o, enlivenedObjects[index]); - } + enlivenedObjects[index] = obj; + reviver && reviver(o, enlivenedObjects[index], error); onLoaded(); }); } From acc3e6d709cc81c5dd42f4bb9d20324c156837a2 Mon Sep 17 00:00:00 2001 From: Asturur Date: Mon, 26 Dec 2016 19:20:29 +0100 Subject: [PATCH 2/2] add error to imageFromObject --- src/shapes/image.class.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shapes/image.class.js b/src/shapes/image.class.js index 902827f7276..25093787f20 100644 --- a/src/shapes/image.class.js +++ b/src/shapes/image.class.js @@ -628,7 +628,11 @@ * @param {Function} callback Callback to invoke when an image instance is created */ fabric.Image.fromObject = function(object, callback) { - fabric.util.loadImage(object.src, function(img) { + fabric.util.loadImage(object.src, function(img, error) { + if (error) { + callback && callback(null, error); + return; + } fabric.Image.prototype._initFilters.call(object, object.filters, function(filters) { object.filters = filters || []; fabric.Image.prototype._initFilters.call(object, object.resizeFilters, function(resizeFilters) {