Skip to content

Commit 2619460

Browse files
Add missing documentation.
1 parent 232e09a commit 2619460

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lib/async/grpc/remote_error.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55

66
module Async
77
module GRPC
8+
# Represents an error that originated from a remote gRPC server.
9+
# Used as the `cause` of {Protocol::GRPC::Error} when the client receives a non-OK status.
10+
# The message and optional backtrace are extracted from response metadata.
811
class RemoteError < StandardError
12+
# Create a RemoteError from server response metadata.
13+
# @parameter message [String | Nil] The error message from `grpc-message` header.
14+
# @parameter metadata [Hash] Response metadata (extracted from gRPC headers). If it contains a `"backtrace"` key (array of strings), it is set on the error and removed from the hash.
15+
# @returns [RemoteError] The constructed error instance.
916
def self.for(message, metadata)
1017
self.new(message).tap do |error|
1118
if backtrace = metadata.delete("backtrace")

0 commit comments

Comments
 (0)