From the point of view of the integrator, I would prefer 1 type of error, which represents an error at your API level and within this error encodes the cause of the error and a text description to provide additional information. Otherwise, the error handling logic will be overly complex.
For your example, say that the error code is 100 (which corresponds to the Duplicate Company error in the yall spiffy API documentation), and the description in the message "Failed to add ABC Inc because it already exists."
source
share