init(code:message:metadata:cause:)

Create a new RPC error. If the given cause is also an RPCError sharing the same code, then they will be flattened into a single error, by merging the messages and metadata.

RPCError.swift:46
init(code: Code, message: String, metadata: Metadata = [:], cause: (any Error)? = nil)

Parameters

code

The status code.

message

A message providing additional context about the code.

metadata

Any metadata to attach to the error.

cause

An underlying error which led to this error being thrown.