Open javibookline opened 1 month ago
The reason it is useful to return the proper code is that it enables better handling of the response - trying to insert something unprocessable should maybe trigger a manual review (i.e. when inserting a carrier bound to an account, the account does not exist) whereas inserting a duplicate entry does not require that, and automated flows benefit from this distinction.
https://github.com/jambonz/jambonz-api-server/blob/d33d0aa5199eb5c8da649110f19e070659b031dc/lib/routes/api/error.js#L16-L18
When trying to create a resource that already exists, the code returned is 422 (unprocessable resource) when it should return a 409 (conflict).