Problem
JS checks x-relay-error header to distinguish gateway errors from function errors. Elixir treats all errors generically.
Proposed Solution
{:error, %{type: :relay_error, code: :unauthorized}} # Gateway issue
{:error, %{type: :http_error, code: :not_found}} # Function error
{:error, %{type: :network_error}} # Connection issue
Benefits
- Better error diagnosis
- Distinguish gateway vs function errors
- Inform retry strategies
- Feature parity with JS
JS Reference: functions-js/src/FunctionsClient.ts:119-128