EasyRpc.Plugs.ErrorHandler (EasyRpc v1.1.0)

Copy Markdown View Source

Normalises the context after execution.

  • When error_handling: true and the call succeeded, wraps result in {:ok, result}.
  • When error_handling: true and there is an error, wraps error in {:error, error}.
  • When error_handling: false and the call succeeded, leaves the raw result in place.
  • When error_handling: false and there is an error, the context passes through unchanged — the caller (e.g. RpcCall) decides whether to raise.

Short-circuited results (e.g. a cache hit that set halted) are wrapped exactly like ordinary successes, so safe mode always yields a consistent {:ok, _} | {:error, _} shape.