Fabric.js: Option to bubble up image load errors

Created on 27 Dec 2018  路  3Comments  路  Source: fabricjs/fabric.js

Is your feature request related to a problem? Please describe.
I'm trying to render canvases in bulk on Node.js using loadFromJSON with public urls as my object sources. Thereafter I flatten them as pngs. I noticed that on flakey connections, images will fail to load silently (well not exactly, Fabric does log 'Error loading ...' to the console). This is an issue for me because I would prefer Fabric to not render the entire canvas at all than render a canvas with missing objects/background.

Describe the solution you'd like
I am able to specify that errors should be bubbled up, either during canvas instantiation or loading.

Describe alternatives you've considered
I considered using the reviver for bubbling errors, but that would mean I'll have to roll my own promisification of the loadFromJSON method (i'm using bluebird promisify right now). I'll probably do that if it doesn't make sense to support this request.

stale

Most helpful comment

well we could bubble up errors, this is a normal request and a normal feature for libraries.

I think the only way to do that right now is to add a error argument or an additional error callback.

All 3 comments

well we could bubble up errors, this is a normal request and a normal feature for libraries.

I think the only way to do that right now is to add a error argument or an additional error callback.

i know 2 years are passed, and you probably also forgot whatever where we talking here.
But could this PR be a fix for this issue?
https://github.com/fabricjs/fabric.js/pull/6238

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings