grpc-spring-boot-starter: GRpcExceptionHandler doesn't work [Kotlin]

Hi, thanks for the work you’ve done. It’s really great starter!

I have some trouble, maybe it related with Kotlin CoroutineImpl. The interceptor below does not catch exception:

@GRpcService
class TempUrlService() : TempUrlServiceGrpcKt.TempUrlServiceCoroutineImplBase() {

    private val logger = KotlinLogging.logger {}

    @GRpcExceptionHandler
    fun anotherHandler(e: NullPointerException, scope: GRpcExceptionScope): Status {
        logger.warn { "NPE!" }
        return Status.INTERNAL
    }

    @Throws(Throwable::class)
    override suspend fun createThumbnailTempUrl(request: ThumbRequest): ThumbResponse {
        throw NullPointerException("HELLO")
    }
}

Using 4.5.10 version.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 21

Most upvoted comments

Fixed in latest 5.1.5-SNAPSHOT, please verify and confirm.

I created demo project which reproduces both problems https://github.com/TheHett/grpc_demo/tree/master/src/main/kotlin/com/example/demo/grpc

It should be call manually because I doesn’t know how to write test for this

grpc_cli call 127.0.0.1:6565  demo.api.DemoService/test ""