# `Firkin.Error`
[🔗](https://harton.dev/james/firkin)

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`.

# `error_code`

```elixir
@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`

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

# `to_http_status`

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

Returns the HTTP status code for the given error code.

# `to_s3_code`

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

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
