aheckmann / node-ses

An Amazon SES api for nodejs with proper error handling.
http://aheckmann.github.com/node-ses
MIT License
201 stars 37 forks source link

Use Error instance for better integration #46

Open allevo opened 6 years ago

allevo commented 6 years ago

When amazon returns an error, an object is used as error

Which is the benefit of this approach ?

markstos commented 6 years ago

Are you comparing the current approach returning strings or returning Error objects?

allevo commented 6 years ago

I'm concerned about the Object usage instead of Error. Particularly when the Error interface is lost The used property Message is not compliant with the javascript world. The error handling will be a nightmare.

markstos commented 6 years ago

I agree that returning an Error object instead of plain object could be helpful.

The properties Type, Code and Message were chosen for consistency with the other responses that Amazon provides.

You are welcome to propose the specifics of an alternate approach. If it's not backwards-compatible, impact on existing code bases using node-ses should be considered.

The official AWS JavaScript SDK and node-mailer may be useful references.