fromStreamError

public static Optional<Error> fromStreamError(Throwable throwable)

Extracts a system error from the Throwable received on a client-side as a result of a failed gRPC call to server-side routines.

The Error is extracted from the trailer metadata of either StatusRuntimeException or StatusException only.

If any other type of Throwable is passed, Optional.empty() is returned.

Return

the extracted error or Optional.empty() if the extraction failed

Parameters

throwable

the Throwable to extract an Error