Browse Source

Merge pull request #119 from kchodorow/master

Display the load error, if available
pull/125/head
James Cryer 7 years ago committed by GitHub
parent
commit
f78a9dea37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      nodejs-tests/compareImages.test.js
  2. 2
      nodejs-tests/resemble.test.js
  3. 4
      resemble.js

2
nodejs-tests/compareImages.test.js

@ -34,6 +34,6 @@ describe('compareImages', () => {
fs.readFileSync('./demoassets/People.jpg'), fs.readFileSync('./demoassets/People.jpg'),
'bogus data' 'bogus data'
); );
await expect(promise).rejects.toMatch('Image load error.'); await expect(promise).rejects.toMatch('Error: error while reading from input stream');
}); });
}); });

2
nodejs-tests/resemble.test.js

@ -64,7 +64,7 @@ describe('resemble', () => {
.onComplete(function(data) { .onComplete(function(data) {
// console.info('Reached oncomplete for request_404'); // console.info('Reached oncomplete for request_404');
// console.log(data); // console.log(data);
expect(data.error).toEqual('Image load error.'); expect(data.error).toEqual('Error: error while reading from input stream');
resolve(); resolve();
}); });
}); });

4
resemble.js

@ -200,9 +200,9 @@ URL: https://github.com/Huddle/Resemble.js
hiddenImage.setAttribute('crossorigin', 'anonymous'); hiddenImage.setAttribute('crossorigin', 'anonymous');
} }
hiddenImage.onerror = function () { hiddenImage.onerror = function (err) {
hiddenImage.onerror = null; //fixes pollution between calls hiddenImage.onerror = null; //fixes pollution between calls
images.push({ error : "Image load error."}); images.push({ error : err ? err + "" : "Image load error." });
callback(); callback();
}; };

Loading…
Cancel
Save