Ensure resize error from C++ is wrapped

Thanks to @papandreou
This commit is contained in:
Lovell Fuller
2014-10-23 09:39:37 +01:00
parent 3e1be7a33a
commit 97fc2a2a3a
4 changed files with 14 additions and 3 deletions

View File

@@ -198,6 +198,15 @@ describe('Input/output', function() {
done();
});
it('Fail when input is invalid Buffer', function(done) {
sharp(new Buffer([0x1, 0x2, 0x3, 0x4]))
.toBuffer(function (err) {
assert.ok(err);
assert.ok(err instanceof Error);
done();
});
});
it('Promises/A+', function(done) {
sharp(fixtures.inputJpg).resize(320, 240).toBuffer().then(function(data) {
sharp(data).toBuffer(function(err, data, info) {