Catalog-Based Error Handling for Service-Layer Responses

Overview

Catalog-Based Error Handling standardizes how service-layer failures are communicated to API consumers. Instead of returning hard-coded or raw exception text, the service layer resolves each error through ASERRORCATALOG whenever a catalog entry is available.

The approach provides stable error identifiers, user-oriented messages, and actionable guidance while preserving the business meaning of existing service errors. It applies to request validation, parsing, authentication, authorization, media-type negotiation, business processing, and system-failure scenarios that reach the service-layer error-handling path.

ASERRORCATALOG as the central source of service errors

ASERRORCATALOG is the authoritative source for consumer-facing service error content. The service layer uses the catalog identifier to obtain the approved error message, cause, and fix tip. The exception mapper resolves this output through ErrorCatalogBll. This creates a single, maintainable definition of an error across the supported service endpoints.

  • Catalog entries provide the canonical error number and customer-facing text.
  • The error mapping layer selects the most specific applicable catalog entry for the condition.
  • Service consumers receive safe, consistent responses rather than framework, database, or implementation details.
  • Catalog-managed content follows the existing product translation and locale behavior; this feature does not introduce a new translation or locale framework.

Standard service error response

All mapped and fallback service-layer errors use the existing HTTP response structure. The details object includes the catalog error number in addition to the message, cause, and fix tip. This preserves the established response shape while making the catalog identifier available for programmatic handling.

Table - Service error response fields

Field Description
status HTTP status code associated with the error condition.
localMessage Standard HTTP status text returned with the response.
details.errorNumber Canonical ASERRORCATALOG identifier used by the service response.
details.errorMessage Approved, user-facing description of the error.
details.errorCause Catalog-controlled explanation of why the error occurred.
details.errorFixTip Actionable guidance for correcting the request or addressing the issue.

Example response

{
  "status": 400,
  "localMessage": "Bad Request",
  "details": {
    "errorNumber": "REST:EmptyRequest",
    "errorMessage": "The request payload is empty.",
    "errorCause": "The service received no request content for an operation that requires a payload.",
    "errorFixTip": "Provide a valid request payload and submit the request again."
  }
}

Response safety. The service does not populate these fields with raw exception text, stack traces, nested causes, SQL errors, class names, or endpoint implementation details. The fields are catalog-controlled or, only when required, sanitized built-in fallback values.

Reuse existing catalog entries

Existing ASERRORCATALOG entries are reused when their business meaning precisely matches the detected condition. Reuse preserves stable identifiers for existing consumers and avoids creating competing definitions for the same error.

Table - Reusable catalog entries

Error category Examples of reusable entries Use
Existing endpoint validation REST:FRInvalidFileId; REST:ECComputationIdNotFound; REST:PVInvalidPolicyNumber; REST:PVInvalidFieldName; REST:PVMissingField; REST:PPInvalidPolicyNumber Return the existing entry when the corresponding endpoint-specific condition occurs.
Existing resource and business conditions REST.ResourceNotAvailable; REST.InvalidField; REST.UpdateNotAllowed; REST.ParameterNotAvailable Reuse only when the existing entry accurately describes the business condition.
Policy Withholding duplicate resource REST.ResourceAlreadyExists Retained for its existing Policy Withholding-specific meaning and not generalized for unrelated resources.

Duplicate-resource guidance. REST:DuplicateResource is the new generic catalog entry for duplicate-resource conflicts across service-layer operations. Where supported, the response can use sanitized placeholders such as {resourceName} and {resourceId}.

Generic service-layer catalog coverage

New catalog rows cover generic service-layer conditions that are not represented by an existing business-specific catalog entry. These rows allow the service layer to return standard, actionable errors for common request and processing failures.

Table - Generic service-layer error categories

Category Catalog entries Typical HTTP status
Request validation and parsing REST:EmptyRequest; REST:InvalidRequest; REST:InvalidRequestData; REST:InvalidJsonRequest; REST:InvalidXmlRequest; REST:MissingFileIdParameter; REST:MissingRequiredField; REST:MissingRequiredFields; REST:InvalidParameterArray 400 Bad Request
Media-type negotiation REST:NotAcceptable; REST:UnsupportedMediaType 406 Not Acceptable; 415 Unsupported Media Type
Authentication and authorization REST:InvalidCredentials; REST:AccessDenied; REST:AuthenticationProcessingFailed; REST:AuthorizationProcessingFailed 401, 403, or 500, as applicable
Processing and system conditions REST:ErrorProcessingRequest; REST:InternalProcessingError 500 Internal Server Error
Generic conflict REST:DuplicateResource 409 Conflict

Unsupported Accept values return REST:NotAcceptable with HTTP 406. Unsupported Content-Type values return REST:UnsupportedMediaType with HTTP 415 only when a request body specifies an unsupported Content-Type; bodyless GET requests do not use Content-Type for request validation.

When more than one condition could apply, authentication and authorization run first. Media-type negotiation is then evaluated before request parsing, field validation, and business processing. Within request validation and parsing, the expected precedence is: empty request; JSON/XML parsing error; endpoint-specific missing parameter; missing required field; invalid parameter-array structure; invalid request structure; invalid request data; known processing error; and internal fallback.

Fallback behavior

Fallback behavior ensures that consumers receive a safe and predictable response even when an exception cannot be mapped to a specific entry or the intended catalog row cannot be resolved.

Table - Fallback response behavior

Situation Response behavior
Unmapped runtime or system exception Return REST:InternalProcessingError with HTTP 500. This is the official default fallback.
Known request-processing failure after request acceptance Return REST:ErrorProcessingRequest with HTTP 500 only when the condition is known and classified as request-processing related. It is not the default fallback.
Unmapped parsing or validation issue Return REST:InvalidRequestData with HTTP 400 when a more specific validation or parsing entry cannot be resolved.
Missing, inactive, or incomplete intended catalog row Log the catalog-resolution issue internally and apply the safe fallback appropriate to the error category. For authentication and authorization, preserve the correct HTTP status where possible and use the corresponding safe security fallback. Do not expose raw exception text.
Fallback row also missing or incomplete Return a sanitized built-in REST:InternalProcessingError response with all standard details fields and generic safe text only.

Important. Internal diagnostic details may be logged for support analysis. They are never returned in the service response.

Error Catalog to HTTP Status Mapping

The catalog error ID determines the consumer-facing error content, while the service exception mapper determines the HTTP status. These mappings must remain stable for implementation and QA validation.

Table - Error catalog to HTTP status mapping

Error ID HTTP Status Error Type Usage Fix Tip
REST:EmptyRequest 400 Bad Request Validation Error Request body is null, blank, or missing when a payload is required. Provide a valid request payload and submit the request again.
REST:InvalidRequest 400 Bad Request Validation Error Request structure is invalid, but it is not malformed JSON or XML and no more specific error applies. Review the service contract and submit a request with the expected structure.
REST:InvalidRequestData 400 Bad Request Validation Error Request data fails validation and no more specific catalog mapping is available. Correct the request data and submit the request again.
REST:InvalidJsonRequest 400 Bad Request Validation Error Request body is malformed or cannot be parsed as JSON. Correct the JSON payload and submit the request again.
REST:InvalidXmlRequest 400 Bad Request Validation Error Request body is malformed or cannot be parsed as XML. Correct the XML payload and submit the request again.
REST:MissingRequiredField 400 Bad Request Validation Error Exactly one required request field is missing. Provide a value for the missing field and submit the request again.
REST:MissingRequiredFields 400 Bad Request Validation Error More than one required request field is missing. Provide values for all missing fields and submit the request again.
REST:InvalidParameterArray 400 Bad Request Validation Error A parameter is expected to be an array, but the supplied value is not in the expected array format. Provide the parameter data as a valid array and submit the request again.
REST:MissingFileIdParameter 400 Bad Request Validation Error The required fileId parameter is absent, null, or blank. Provide a valid fileId parameter and submit the request again.
REST:InvalidCredentials 401 Unauthorized Authentication Error Credentials are missing, invalid, expired, or cannot be authenticated. Verify the credentials and submit the request again.
REST:AccessDenied 403 Forbidden Authorization Error The user is authenticated but does not have permission to perform the requested operation. Request the required access or use credentials with the appropriate permissions.
REST.ResourceAlreadyExists 409 Conflict Existing Catalog Entry Existing Policy Withholding-specific duplicate-resource error, retained for backward compatibility. Use the existing catalog-defined fix tip for the Policy Withholding-specific error.
REST.ResourceNotAvailable 404 Not Found Existing Catalog Entry Requested resource is not available; the existing error ID is retained for backward compatibility. Use the existing catalog-defined fix tip for the resource-unavailable error.
REST:AuthenticationProcessingFailed 500 Internal Server Error Authentication Error An internal failure occurs while authentication is being processed; it is not caused by invalid credentials. Retry the request later. If the issue continues, contact Support.
REST:AuthorizationProcessingFailed 500 Internal Server Error Authorization Error An internal failure occurs while authorization is being evaluated; it is not a standard access-denied condition. Retry the request later. If the issue continues, contact Support.
REST:InternalProcessingError 500 Internal Server Error System Error Official default fallback for unmapped runtime or system exceptions, including an unavailable or incomplete fallback catalog row. Retry the request later. If the issue continues, contact Support with the request or transaction reference.
REST:ErrorProcessingRequest 500 Internal Server Error Processing Error A known request-processing failure occurs after the request has been accepted. It is not the default fallback. Retry the request. If the issue continues, contact Support with the request or transaction reference.
REST:DuplicateResource 409 Conflict Conflict Error A create request conflicts with an existing resource that has the same identifier. Sanitized resourceName and resourceId placeholders may be used where supported. Use a different resource identifier or update the existing resource.
REST:NotAcceptable 406 Not Acceptable Validation Error The Accept header specifies a response media type that the endpoint cannot produce. Use a supported media type in the Accept header.
REST:UnsupportedMediaType 415 Unsupported Media Type Validation Error A request containing a body specifies an unsupported Content-Type. This does not apply to bodyless GET requests. Use a supported Content-Type, such as application/json or application/xml.

Configuration note. All new catalog rows use REST:<ErrorName> naming and are seeded with SYSTEMINDICATOR = Y. Existing REST. entries may be reused when their established business meaning is correct and backward compatibility requires retaining the existing identifier.

Authentication and authorization behavior

Application-level authentication and authorization errors use catalog-controlled responses when the failure reaches the PAS REST application. REST:InvalidCredentials is used for missing, invalid, expired, or unrecognized credentials; REST:AccessDenied is used when an authenticated user lacks the required permission.

Failures that occur during authentication or authorization processing, rather than because credentials are invalid or access is denied, use REST:AuthenticationProcessingFailed or REST:AuthorizationProcessingFailed, respectively, with HTTP 500. Container-managed authentication failures that are rejected before the request reaches service-layer application code continue to return the existing container-generated HTTP 401 response.

Naming convention for new service-layer errors

All newly introduced REST service-layer error identifiers follow this naming convention: REST:<ErrorName>. The convention is used for new generic entries such as REST:InvalidRequestData, REST:NotAcceptable, REST:UnsupportedMediaType, and REST:InternalProcessingError.

  • Use REST:<ErrorName> for every newly introduced service-layer catalog entry.
  • Do not rename existing REST. entries solely to align with the new convention.
  • Existing REST. entries may continue to be reused when their established business meaning is correct and backward compatibility requires the existing identifier.

Customer and configuration best practices

  • Use errorNumber as the stable reference for integrations, support cases, and automated client handling.
  • Use the error message, cause, and fix tip together to correct request issues without relying on implementation details.
  • For new service conditions, first determine whether an existing catalog row precisely fits; add a generic row only when no appropriate reusable entry exists.
  • Keep catalog message, cause, and fix-tip values user-friendly, actionable, and free of sensitive internal details.
  • Use supported placeholders only with sanitized values, for example {fieldName}, {fieldNames}, {parameterName}, {resourceName}, {resourceId}, and {expectedFormat}.
  • Product-delivered service-layer catalog rows are seeded with ASERRORCATALOG.SYSTEMINDICATOR = 'Y'.

Scope and compatibility

This feature standardizes service error resolution and catalog content; it does not redesign the full service API contract, add user-interface maintenance screens, or introduce a new locale translation framework. Existing identifiers are preserved where feasible to maintain compatibility for current consumers.