forError static method

RpcMetadata forError(
  1. Object error, {
  2. int? maxMessageLength,
})

The trailer answering error, which a handler or the code around it threw: through wireStatusFor, so a foreign error's text stays on this side.

Implementation

static RpcMetadata forError(Object error, {int? maxMessageLength}) {
  final wire = wireStatusFor(error);
  return status(
    wire.status,
    message: wire.message,
    statusDetailsBin: wire.detailsBin,
    maxMessageLength: maxMessageLength,
  );
}