I am using Armeria 1.3.0 and protobuf for a gRPC service. I've tried to use rich error model when handling exceptions but I think Armeria seems to only support standard error model.
How can I use rich error model in Armeria? I want to return custom error code/message and more details about error when exception occurred.
Thanks for your answer in advance.
It was not possible to attach arbitrary gRPC Metadata
to a gRPC error response till Armeria 1.5.0, but you will be able to do so from the next minor update (1.6.0):
GrpcService
.builder()
.addExceptionMapping(MyException.class, (cause, metadata) -> {
metadata.put(MY_KEY, myValue)
return Status.XXX.withDescription("...");
})
...
See https://github.com/line/armeria/pull/3329 for the detail.