node-ses icon indicating copy to clipboard operation
node-ses copied to clipboard

internal "RequestError" Message should return a string, not an object

Open markstos opened this issue 9 years ago • 1 comments

When we catch non-Amazon-Web-Services errors, we try to present them in the format that AWS does for consistency.

AWS returns a human-readable string in the Message field. But here, when we capture a "RequestError", we are currently returning an object:

https://github.com/aheckmann/node-ses/blob/master/lib/email.js#L61

Here's an example of object that was actually returned:

{
  "code": "ECONNRESET",
  "errno": "ECONNRESET",
  "syscall": "read"
}

Unfortunately, no part of that is a human-readable description that we could directly map to our own Message property.

We could use the errno library to get human-readable descriptions of the errors, in cases where the errno key is found.

The current mismatch between strings and objects could cause a failure elsewhere in an application if it's expecting that "Message" will always be a string.

markstos avatar Aug 10 '16 16:08 markstos

We also generate an internal "ParseError" I have not checked to confirm it returns a string or an object as the "error" value.

markstos avatar Aug 10 '16 16:08 markstos