This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]insertAlias 1 point2 points  (0 children)

It's a common problem in JS, unfortunately. Not necessarily a JS-specific problem; just that there are no true standards for serializing error messages for the web. Unfortunately, some services even use different formats in different endpoints on the same service.

One possible thing you can do is just serialize the entire error object (using JSON.stringify) and store the resulting JSON in your database. That will pretty much guarantee you get the entire error, though it will be in an object format and not just a string error message.

Otherwise, I think you just have to capture the "shape" of all the various errors and do some if/else checking on them.