clarkie / dynogels

DynamoDB data mapper for node.js. Originally forked from https://github.com/ryanfitz/vogels
Other
490 stars 110 forks source link

Add Dynogels specific errors for create, get and destroy #100

Open svanzoest opened 7 years ago

svanzoest commented 7 years ago

Produce dynogels-specific errors #73 was closed, however, #74 only handled update.

clarkie commented 6 years ago

Happy to take a PR if you have time?

Thanks

Clarkie

jkav77 commented 6 years ago

Is this just a matter of rewriting the return statement on the create, get and destroy methods? Are there any side effects to doing this? @cdhowie?

cdhowie commented 6 years ago

The only side effect would be code that depends on the existing structure of errors. For example, in #74 I changed the message from a JSON string to a human-readable string, and instead put the previously-stringified object onto the error object.

Existing code using dynogels might try to parse the error message as JSON, and that would fail after changing. However, I would argue that parsing error messages is a fragile approach to begin with.

tl;dr: It's technically backwards-incompatible, but I don't think we should care in this instance.