jimp
jimp copied to clipboard
`getBufferAsync()` throws a string instead of an Error
Expected Behavior
Jimp.read(v)
.then(lenna => lenna.resize(2000, Jimp.AUTO).getBufferAsync(`png`))
.catch(e => {
console.log(`type of e`, typeof e);
throw e;
})
Should log object
Current Behavior
logs string
Failure Information (for bugs)
Steps to Reproduce
Here is a minimal reproducible example
import Jimp from "jimp";
Jimp.read(`response.png`)
.then(lenna => lenna.resize(2000, Jimp.AUTO).getBufferAsync(`png`))
.catch(e => {
console.log(`type of e should be object`, typeof e);
console.log(`e should be an instance of Error`, e instanceof Error);
});
Context
- Jimp Version: 0.16.1
- Operating System: windows 10
- Node version: 16.13.1
I am reporting this error because this broke my error catching express middleware.
Before the fix
Fixing by doing
.catch(e => {
console.log(`type of e`, typeof e);
throw new Error(e);
})
After the fix
Hope to see this fixed soon 👍
bump
'png'
written like this isn't a MIME type !
Replace .getBufferAsync(`png`)
with .getBufferAsync(Jimp.MIME_PNG)
instead
@intradeus @noahdeering can you please read. the issue states that the function is throwing a string not an error
bump
If anyone wants to submit a PR for this issue the fix should be easy. Willing to help merge and release!
@hipstersmoothie #1138