Mapping Error Codes to HTTP Result Codes

You can map MATRIXX Error codes to HTTP result codes in RS Gateway properties files.

You can map MATRIXX error codes to specific HTTP result codes. Specify the mapping in the properties files loaded by RS Gateway (rsgateway.yaml or rsgateway-extension.yaml).

RS Gateway looks for properties with the prefix MtxResultToHttpResult. and removes the prefix. If the remaining property name is "default" then the value of this property represents the HTTP result code that is returned if no other properties are found; otherwise, the remaining property name is assumed to be a MATRIXX error code and the value is the HTTP result code that is returned.

In the following example, MATRIXX error codes are mapped to the HTTP result code 500. The default value mapping is used when no other properties are found.
MtxResultToHttpResult:
  default: 500
  0: 500
  -1: 500
  11: 500
  19: 500
  10: 500
  21: 500
  40: 500
  41: 500
  -2: 500
  25: 500 
The following configuration shows the out-of-the box error code mapping:
MtxResultToHttpResult:
  default: 200
  0: 200
  -1: 400
  11: 404
  19: 409
  10: 422
  21: 422
  40: 422
  41: 422
  -2: 500
  25: 500 
Where:
  • 200 = HttpStatus.OK
  • 400 = HttpStatus.BAD_REQUEST
  • 404 = HttpStatus.NOT_FOUND
  • 409 = HttpStatus.CONFLICT
  • 422 = HttpStatus.UNPROCESSABLE_ENTITY
  • 500 = HttpStatus.INTERNAL_SERVER_ERROR
Note: RS Gateway supports only one mapping; the presence of any MtxResultToHttpResult entries in the properties file completely removes the default mapping. If there are no MtxResultToHttpResult entries in the properties file then the default mapping is used. You cannot map a single MATRIXX error code to different HTTP result codes based on the URL or SERVICE called.