call method

  1. @override
Future<ResponseEntity> call(
  1. RequestEntity request,
  2. Exception exception,
  3. StackTrace stackTrace
)
override

Implementation

@override
Future<ResponseEntity> call(
  RequestEntity request,
  Exception exception,
  StackTrace stackTrace,
) async {
  if (exception is ResponseException) {
    return exception.responseEntity;
  } else if (exception is ValidationException) {
    return ResponseEntity(
      exception.statusCode,
      body: om.serialize(exception.violations),
    );
  } else if (exception is ApiException) {
    return ResponseEntity(
      exception.statusCode,
      body: exception.body,
      headers: exception.headers,
    );
  }
  return ResponseEntity.internalServerError(body: exception.toString());
}