@@ -318,13 +318,18 @@ module Async
318318 end
319319 end
320320
321- # Check gRPC status and raise error if not OK
321+ # Check gRPC status and raise error if not OK
322322 def check_status! (response )
323323 status = Protocol ::GRPC ::Metadata .extract_status(response.headers)
324- if status != Protocol ::GRPC ::Status ::OK
325- message = Protocol ::GRPC ::Metadata .extract_message(response.headers)
326- raise Protocol ::GRPC ::Error .new (status, message)
327- end
324+
325+ return if status == Protocol ::GRPC ::Status ::OK
326+
327+ message = Protocol ::GRPC ::Metadata .extract_message(response.headers)
328+ metadata = Protocol ::GRPC ::Methods .extract_metadata(response.headers)
329+
330+ remote_error = RemoteError .for(message, metadata)
331+
332+ raise Protocol ::GRPC ::Error .for(status, metadata: metadata), cause: remote_error
328333 end
329334 end
330335 end
@@ -1001,7 +1006,7 @@ This enables async-grpc to be used as a drop-in replacement for the standard `gr
10011006### Phase 1: Core Client (✅ Designed)
10021007 - ` Async::GRPC::Client ` with all four RPC types
10031008 - ` Async::GRPC::ServerCall ` context object (enhances Protocol::GRPC::Call)
1004- - Basic error handling and status checking
1009+ - Error handling with backtrace support via ` RemoteError ` and exception chaining
10051010 - Response body wrapping pattern
10061011 - ** Server** : Just use ` Protocol::GRPC::Middleware ` with ` Async::HTTP::Server ` (no wrapper needed!)
10071012
0 commit comments