
How not to return API errors - eatonphil
http://blog.shopful.me/how-not-to-return-api-errors
======
fieryeagle
As cliched as it may sound, it...depends on how is the API consumed? Is the
error code going be processed further and passed onto logger or other sub-
systems? Are there possible cases of collision with other existing
enumerations or type restriction (magic handling relies on error code being of
a certain value, for example). Most common way is to have an array of
enumerated constants in code and that also adds a maintenance debt across
front and back ends to sync up unless there is a separate micro-service to
enquire about those enumerations which translates to extra development cost.
It could get complicated fast and so on. Oh, hopefully the documentation (or
code comment) stays up to date as well.

