ExAzureCore.Errors.HttpError exception (ex_azure_core v0.2.0)

Copy Markdown

Error representing HTTP-level failures from Azure services.

This error is raised when an HTTP request completes but returns a non-successful status code (4xx or 5xx).

Fields

  • :status - HTTP status code
  • :error_code - Azure error code from response body (if available)
  • :message - Error message from Azure or generated
  • :request_id - Azure request ID for correlation
  • :url - The URL that was requested

Summary

Functions

Create an Elixir.ExAzureCore.Errors.HttpError without raising it.

Creates an HttpError from an Azure error response body.

Types

t()

@type t() :: %ExAzureCore.Errors.HttpError{
  __exception__: term(),
  bread_crumbs: term(),
  class: term(),
  error_code: String.t() | nil,
  message: String.t() | nil,
  path: term(),
  request_id: String.t() | nil,
  splode: term(),
  stacktrace: term(),
  status: integer() | nil,
  url: String.t() | nil,
  vars: term()
}

Functions

exception(msg)

@spec exception(opts :: Keyword.t()) :: %ExAzureCore.Errors.HttpError{
  __exception__: term(),
  bread_crumbs: term(),
  class: term(),
  error_code: term(),
  message: term(),
  path: term(),
  request_id: term(),
  splode: term(),
  stacktrace: term(),
  status: term(),
  url: term(),
  vars: term()
}

Create an Elixir.ExAzureCore.Errors.HttpError without raising it.

Keys

  • :status
  • :error_code
  • :message
  • :request_id
  • :url

from_response(status, body, request_id \\ nil, url \\ nil)

@spec from_response(integer(), map() | binary(), String.t() | nil, String.t() | nil) ::
  t()

Creates an HttpError from an Azure error response body.

Azure services typically return errors in the format:

{
  "error": {
    "code": "ErrorCode",
    "message": "Error message"
  }
}