Browse Source

Display the load error, if available

pull/119/head
Kristina Chodorow 7 years ago
parent
commit
0cb7a4b8bc
  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'),
'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) {
// console.info('Reached oncomplete for request_404');
// console.log(data);
expect(data.error).toEqual('Image load error.');
expect(data.error).toEqual('Error: error while reading from input stream');
resolve();
});
});

4
resemble.js

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

Loading…
Cancel
Save