Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors #510

Merged
merged 4 commits into from
Aug 5, 2018
Merged

Errors #510

merged 4 commits into from
Aug 5, 2018

Conversation

hipstersmoothie
Copy link
Collaborator

@hipstersmoothie hipstersmoothie commented Aug 4, 2018

  • better error catching in parseBitmap
  • only emit error if there is no callback in constructor

closes #420
closes #422
closes #454
closes #347
closes #353
closes #408

Small code change, big impact 🎉

@hipstersmoothie hipstersmoothie added the bug there is a bug in the way jimp behaves label Aug 4, 2018
jimpInstance.emitError('constructor', err);
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure why you want to change the behavior of this ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(The rest looks good to me)

Copy link
Collaborator Author

@hipstersmoothie hipstersmoothie Aug 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If jimp emits the error then the callback will never be called with error, and the promise never catches the error. this change makes it so that jimp either

  1. calls the callback with the error
  2. rejects with the error
  3. or if no callback or promise is provided it emits the error

when we were calling emitError the whole exectution of the program would stop if you didn't have an on('error'). All the issues basically arose from just this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug there is a bug in the way jimp behaves
Projects
None yet
2 participants