-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image given has not completed loading error handling #520
Comments
Could you include an example of the |
Surely even if the data content was "Hello world" we should be able to handle the exception gracefully? |
I need a way to reproduce the error, otherwise I can't really fix it. |
Also, is this happening in the browser, or on the server, in the node.js environment? The stacktrace here suggests it's in node.js: https://www.bountysource.com/issues/4212799-uploaded-image-not-persisting?utm_source=4212799&utm_medium=shield&utm_campaign=ISSUE_BADGE And it looks like that error message has its origins in the node-canvas package: |
If you try "hello world" as the data does it replicate it? I expect it will... Can get data if you want just want you to understand the point error handling should be doable.. Let me know if you want me to get the data :) Thanks!! ----- Reply message ----- I need a way to reproduce the error, otherwise I can't really fix it. — |
Node.is Sent from my HTC ----- Reply message ----- Also, is this happening in the browser, or on the server, in the node.js environment? The stacktrace here suggests it's in node.js: https://www.bountysource.com/issues/4212799-uploaded-image-not-persisting?utm_source=4212799&utm_medium=shield&utm_campaign=ISSUE_BADGE And it looks like that error message has its origins in the node-canvas package: — |
Parsing 'hello world' will throw a JSON error for sure: |
Sorry about the delay, here is the data..
|
Hmm, strange. That works for me, in Node.js. What version of node-canvas are you using? I'm on canvas@1.1.6 var paper = require('paper');
var data = "data:image/jpeg;base64,...";
paper.setup(new paper.Canvas(600, 600));
var raster = new paper.Raster(data);
raster.position = paper.view.center;
paper.view.exportFrames({
amount: 1,
directory: __dirname
}); |
Yea that is weird I don't get the error with our test case... *Boggles...
|
Removing some content returns
This is expected behavior.. |
Perhaps if I give you a way to replicate the bug in situe it will help.. Repo is: https://github.com/johnmclear/draw You will need a slow(ish) internet connection, upload a jpg and while the jpg is uploading close the window.. This will cause JohnMcLear/draw#179
The weird thing is if I |
For whatever a reason an incomplete/currupt image may end up getting through a file upload/whatever process.
At current if one passes this image data to paper using:
An error will be thrown and your node thread killed. Obviously this is not ideal, at no point should paper.js throw an exception that can't be handled gracefully.
Is the the correct way to use a callback to dictate success/failure?
I tried wrapping in a try, catch but obviously that didn't work, there is no onError event (or so it seems).. Sorry if I'm missing something obvious here...
The text was updated successfully, but these errors were encountered: