jimp-dev / jimp

An image processing library written entirely in JavaScript for Node, with zero external or native dependencies.
http://jimp-dev.github.io/jimp/
MIT License
14.07k stars 761 forks source link

Catching errors on faulty image urls is not working. #536

Closed itsTeknas closed 6 years ago

itsTeknas commented 6 years ago
return Jimp.read(url).catch(err => {
    console.log("Caught 404");
    console.log(err);
 });
/Users/Sanket/WebstormProjects/project/node_modules/jpeg-js/lib/decoder.js:598
        throw new Error("SOI not found");
              ^
Error: SOI not found
    at constructor.parse (/Users/Sanket/WebstormProjects/project/node_modules/jpeg-js/lib/decoder.js:598:15)
    at Object.decode (/Users/Sanket/WebstormProjects/project/node_modules/jpeg-js/lib/decoder.js:983:11)
    at Jimp.parseBitmap (/Users/Sanket/WebstormProjects/project/node_modules/jimp/src/utils/image-bitmap.js:117:36)
    at /Users/Sanket/WebstormProjects/project/node_modules/jimp/src/index.js:283:29
    at /Users/Sanket/WebstormProjects/project/node_modules/jimp/src/index.js:82:24
    at /Users/Sanket/WebstormProjects/project/node_modules/jimp/src/request.js:52:21
    at IncomingMessage.<anonymous> (/Users/Sanket/WebstormProjects/project/node_modules/phin/lib/phin.compiled.js:1:2049)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)
itsTeknas commented 6 years ago

Might be related to #262

itsTeknas commented 6 years ago

This functionality is working in v0.2.27

hipstersmoothie commented 6 years ago

Should work in v0.3.3 when it gets released. 🙏 @oliver-moran