jeremydaly / data-api-client

A "DocumentClient" for the Amazon Aurora Serverless Data API
MIT License
441 stars 62 forks source link

Errors could be more useful #82

Closed ryanhuff closed 3 years ago

ryanhuff commented 3 years ago

When a query fails, I'm getting the error.code "BadRequestException" -- which is the same as the error.name. I think this is meant to be the database error code, so is likely a bug.

Ex: I have a unique index on a table. When an insert fails because of that constraint, I should get back error code 1062. Now, I'm getting the error.message = "Database error code: 1062. Message: Duplicate entry 'company-1-c9be652b-9d1f-4261-9d97-1e1c10bb6de8' for key 'account_src"

So I'm going to need to parse that out of the message.

ryanhuff commented 3 years ago

What do you know? I'm an idiot. I was overwriting the message property in some code left over before migrating to this API...