question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GRpcExceptionHandler doesn't work [Kotlin]

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:16

github_iconTop GitHub Comments

1reaction
TheHettcommented, Dec 13, 2021

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 ""
0reactions
YannPerthuiscommented, Mar 15, 2022

Any idea @jvmlet please ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot catch Exception from Server Stub · Issue #141 - GitHub
I am attempting to install a default Exception handler for our gRPC server stubs. I have tried using both a java gRPC interceptor...
Read more >
Micronaut gRPC server endpoint swallows exceptions (other ...
I'm working on a Micronaut gRPC server in Kotlin. By default, if my gRPC endpoint throws an exception, it's swallowed without any logging ......
Read more >
Error Handling in gRPC - Baeldung
Learn how to implement error handling in gRPC for unary and stream-based RPC calls.
Read more >
Coroutine exceptions handling | Kotlin
CoroutineExceptionHandler is invoked only on uncaught exceptions — exceptions that were not handled in any other way.
Read more >
Protocol Buffer Basics: Java - Google Developers
By walking through creating a simple example application, it shows you how to ... 213), and also doesn't work very well if you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found