Simplify gRPC Exception Handling#351
Conversation
|
The import order requirements from our checkstyle checks are annoyingly difficult to get right. I wish we didn't do it, but most Spring projects do it now to cut down on whitespace changes. You can get it right by looking at similar classes and copying the order. This one so far looks easy - you just need a blank line before the springframework imports. |
Introduce annotation-based exception handling for gRPC services, similar to Spring MVC's @ControllerAdvice and @ExceptionHandler. This allows simplified exception handling: @GrpcAdvice class MyExceptionHandler { @GrpcExceptionHandler fun handle(ex: TimeoutException): Status { return Status.DEADLINE_EXCEEDED.withDescription(ex.message) } } Signed-off-by: Oleksandr Shevchenko <oleksandr.shevchenko@datarobot.com> [resolves spring-projects#350]
Thanks @dsyer . I've pushed style changes |
|
If you build locally with Java 25 you should get the same error I guess. |
Signed-off-by: Oleksandr Shevchenko <oleksandr.shevchenko@datarobot.com>
|
All good thanks. It’ll get merged once we branch off to 1.1.x. |
Introduce annotation-based exception handling for gRPC services
This allows simplified exception handling:
Signed-off-by: Oleksandr Shevchenko shevchenko.olexandr96@gmail.com
Inspired and heavily relies on https://github.com/grpc-ecosystem/grpc-spring/blob/master/grpc-server-spring-boot-starter/src/main/java/net/devh/boot/grpc/server/advice/GrpcExceptionHandler.java#L69
[resolves #350]