onError method
Implementation
@override
FutureOr<Response> onError(
Message message, T exception, StackTrace stackTrace) {
var body = JsonBody({
"exception": exception.toString(),
"stack_trace": stackTrace.toString()
});
var statusCode = (exception is StyleException) ? exception.statusCode : 500;
if (message is Response) {
return message
..body = body
..statusCode = statusCode;
} else {
return (message as Request).response(body, statusCode: statusCode);
}
}