ApifyClient.Error exception (apify_client v1.0.0)

Copy Markdown View Source

Error returned (or, from streams, raised) by every Apify API call.

Functions return {:error, %ApifyClient.Error{}}; lazy streams such as ApifyClient.Datasets.stream_items/2 raise it, since it is an exception.

For API errors, details contains:

  • :status_code - the HTTP status
  • :error_type - the API's error type, for example "record-not-found", when the response has one
  • :body - the (decoded) response body

Network errors have the transport :reason in details.

Summary

Functions

Returns a human-readable string representation of the error.

Creates a new error struct.

Types

error_type()

@type error_type() ::
  :client_error
  | :server_error
  | :network_error
  | :rate_limit_error
  | :authentication_error
  | :authorization_error
  | :not_found_error
  | :validation_error
  | :conflict_error
  | :timeout_error
  | :stream_error
  | :file_error
  | :unknown_error

t()

@type t() :: %ApifyClient.Error{
  __exception__: term(),
  details: map(),
  message: String.t(),
  type: error_type()
}

Functions

message(exception)

@spec message(t()) :: String.t()

Returns a human-readable string representation of the error.

new(type, message, details \\ %{})

@spec new(error_type(), String.t(), map()) :: t()

Creates a new error struct.