Error Handling

Embarc uses consistent HTTP status codes and a predictable JSON structure for error responses. Understanding that structure makes it easier to surface meaningful messages in your UI.

Status Codes at a Glance

StatusWhen it appearsTypical cause
200 OKSuccessful commands or queriesResource created/updated/fetched without issues
400 Bad RequestValidation or business rule failureMissing mandatory fields, invalid loan state transitions, malformed JSON
401 UnauthorizedAuthentication failureMissing/expired token or Basic credentials
403 ForbiddenAuthenticated but not allowedLacking the required role/permission
404 Not FoundResource lookup failedWrong customer ID, loan ID, or tenant
409 ConflictCommand can’t proceed because of current stateAttempting to disburse an already-closed loan, duplicate external IDs
500 Internal Server ErrorUnexpected server exceptionEmbarc bug or infrastructure issue. Contact support with correlation IDs

Error Payload Shape

{
  "developerMessage": "The request was invalid. This typically will happen due
to validation errors which are provided.",
  "httpStatusCode": "400",
  "defaultUserMessage": "Validation errors exist.",
  "userMessageGlobalisationCode": "validation.msg.validation.errors.exist",
  "errors": [
    {
      "parameterName": "loanType",
      "developerMessage": "The parameter `loanType` is mandatory.",
      "defaultUserMessage": "The parameter `loanType` is mandatory.",
      "userMessageGlobalisationCode":
"validation.msg.loan.loanType.cannot.be.blank"
    }
  ]
}

Key fields to surface:

  • defaultUserMessage — human-readable explanation suitable for UI.
  • errors[] — per-field messages when relevant.
  • httpStatusCode — mirrors the actual HTTP status code for quick triage.

Handling Tips

  1. Treat defaultUserMessage as the primary message for end users; fall back to developerMessage when localising isn’t an option.
  2. When errors[] is present, iterate through it to highlight individual field issues (e.g., inputs on a loan origination screen).
  3. Log the entire payload (with correlation or request IDs) so our support team can trace issues quickly.