Package com.linecorp.armeria.server.grpc
Interface UnframedGrpcErrorHandler
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Error handler which maps a gRPC response to an
HttpResponse
.-
Method Summary
Modifier and TypeMethodDescriptionhandle
(ServiceRequestContext ctx, Status status, AggregatedHttpResponse response) Maps the gRPC error response to theHttpResponse
.static UnframedGrpcErrorHandler
of()
Returns a plain text or json response based on the content type.static UnframedGrpcErrorHandler
of
(UnframedGrpcStatusMappingFunction statusMappingFunction) Returns a plain text or json response based on the content type.static UnframedGrpcErrorHandler
ofJson()
Returns a JSON response based on Google APIs.static UnframedGrpcErrorHandler
ofJson
(UnframedGrpcStatusMappingFunction statusMappingFunction) Returns a JSON response based on Google APIs.static UnframedGrpcErrorHandler
Returns a plain text response.static UnframedGrpcErrorHandler
ofPlainText
(UnframedGrpcStatusMappingFunction statusMappingFunction) Returns a plain text response.
-
Method Details
-
of
Returns a plain text or json response based on the content type. -
of
Returns a plain text or json response based on the content type.- Parameters:
statusMappingFunction
- The function which maps theThrowable
or gRPCStatus
code to anHttpStatus
code.
-
ofJson
Returns a JSON response based on Google APIs. See Google error model for more information. -
ofJson
Returns a JSON response based on Google APIs. See Google error model for more information.- Parameters:
statusMappingFunction
- The function which maps theThrowable
or gRPCStatus
code to anHttpStatus
code.
-
ofPlainText
Returns a plain text response. -
ofPlainText
static UnframedGrpcErrorHandler ofPlainText(UnframedGrpcStatusMappingFunction statusMappingFunction) Returns a plain text response.- Parameters:
statusMappingFunction
- The function which maps theThrowable
or gRPCStatus
code to anHttpStatus
code.
-
handle
Maps the gRPC error response to theHttpResponse
.- Parameters:
ctx
- the service context.status
- the gRPCStatus
code.response
- the gRPC response.- Returns:
- the
HttpResponse
.
-