6.5.1. HTTP Messaging Error Control Handler

This handler catches exceptions and errors that occur in subsequent handlers, performs log output and generates response according to the exceptions (errors). If the response body is not configured in the subsequent handler, configures the default body corresponding to the HTTP status code in the response.

This handler performs the following processes:

The process flow is as follows.

../../../../_images/flow9.png

6.5.1.2. Module list

<dependency>
  <groupId>com.nablarch.framework</groupId>
  <artifactId>nablarch-fw-messaging-http</artifactId>
</dependency>

6.5.1.3. Constraints

Place this handler after the HTTP Response Handler
HttpResponse generated by this handler is processed by the HTTP Response Handler. Therefore, it is necessary that this handler is configured after the HTTP Response Handler.

6.5.1.4. Processes the log output and generates response according to the exception type

nablarch.fw.NoMoreHandlerException
Log level:INFO
Response:404
Description:It is recorded as a trace log since it means that the handler to process the request is not available. The HTTP status code generates a response of 404, which means that there was no action class to process.
nablarch.fw.web.HttpErrorResponse
Log level:No log output
Response:HttpErrorResponse#getResponse()
Description:Log is not output because it means that a business exception (exception as a result of validation, etc.) was raised in a subsequent handler.
nablarch.fw.Result.Error
Log level:Depends on the configuration
Response:Error#getStatusCode()
Description:Sed Log output of nablarch.fw.Result.Error.
nablarch.core.message.ApplicationException and nablarch.fw.messaging.MessagingException
Log level:-
Response:400
Description:The HTTP status code generates a response of 400 because of an exception indicating that the request from the client is incorrect.
Exceptions and errors other than the above
Log level:FATAL
Response:500
Description:For exceptions and errors that do not correspond to the above, log is output as a failure. The response is 500 because it is an unexpected exception or error.

6.5.1.4.1. Log output of nablarch.fw.Result.Error

If the exception raised in the subsequent handler is Error, then whether to output the log changes depending on the value configured in writeFailureLogPattern. A regular expression can be configured to this property, and if the regular expression matches Error#getStatusCode(), a FATAL level log is output.