Normalized error returned by every GcpCompute function.
Errors are returned as {:error, %GcpCompute.Error{}}. The struct is also an
exception, so it can be raised by the bang variants (insert_instance!/3, …)
or with raise/1.
Fields
:reason— a coarse, matchable atom (:api_error,:transport,:timeout,:token_fetch_failed,:operation_failed, …).:status— HTTP status code, when the error came from an API response.:message— human readable message (from GCP when available).:errors— the rawerror.errorslist returned by the Compute API.:body— the underlying body/exception, for debugging.:operation— the failedGcpCompute.Operation, for operation errors.
Summary
Types
@type t() :: %GcpCompute.Error{ __exception__: true, body: term(), errors: list() | nil, message: String.t() | nil, operation: GcpCompute.Operation.t() | nil, reason: atom(), status: non_neg_integer() | nil }
Functions
@spec from_exception(Exception.t()) :: t()
Build a transport-level error from a Req/Mint exception.
@spec from_response(non_neg_integer(), term()) :: t()
Build an error from a non-2xx Compute API response.
Handles the standard Google error envelope:
%{"error" => %{"code" => 403, "message" => "...", "errors" => [...]}}