Firkin.Error (firkin v0.2.1)

Copy Markdown View Source

S3 error representation.

Backend callbacks return {:error, %Firkin.Error{}} to signal errors. The :code atom is mapped to the corresponding S3 error code string and HTTP status by Firkin.Error.to_http_status/1 and Firkin.Error.to_s3_code/1.

Summary

Functions

Returns the HTTP status code for the given error code.

Returns the S3 error code string for the given error code atom.

Types

error_code()

@type error_code() ::
  :access_denied
  | :bucket_already_exists
  | :bucket_not_empty
  | :entity_too_large
  | :internal_error
  | :invalid_argument
  | :invalid_bucket_name
  | :invalid_part
  | :invalid_part_order
  | :no_such_bucket
  | :no_such_key
  | :no_such_upload
  | :not_implemented
  | :precondition_failed
  | :not_modified
  | :signature_does_not_match

t()

@type t() :: %Firkin.Error{
  code: error_code(),
  message: String.t() | nil,
  request_id: String.t() | nil,
  resource: String.t() | nil
}

Functions

to_http_status(atom)

@spec to_http_status(error_code()) :: pos_integer()

Returns the HTTP status code for the given error code.

to_s3_code(atom)

@spec to_s3_code(error_code()) :: String.t()

Returns the S3 error code string for the given error code atom.