Return `Error` object for `autoOrientImage` failures

This commit is contained in:
Daniel Gasienica 2018-02-12 16:23:04 -05:00
parent ff04bad851
commit 032c0ced46
1 changed files with 2 additions and 1 deletions

View File

@ -27,7 +27,8 @@ exports.autoOrientImage = (fileOrBlobOrURL, options = {}) => {
return new Promise((resolve, reject) => {
loadImage(fileOrBlobOrURL, canvasOrError => {
if (canvasOrError.type === 'error') {
const error = canvasOrError;
const error = new Error('autoOrientImage: Failed to process image');
error.cause = canvasOrError;
reject(error);
return;
}