7.11Normalize errors into your API contract
Bad response:
{
"error": "SALESFORCE:INVALID_INPUT",
"description": "INVALID_FIELD_FOR_INSERT_UPDATE..."
}
Better:
{
"code": "INVALID_CUSTOMER",
"message": "Customer could not be processed.",
"correlationId": "abc-123"
}
Internally you log enough diagnostic detail.
Externally you expose your API contract.
Same principle we used with successful responses:
Salesforce contract
≠
public API contract