Spaces:
Sleeping
Sleeping
Download apps/elixir-sdk/lib/firecrawl/error.ex from s-eto-hub/firecrawl-api: direct link, hf CLI and curl.
- Browser
- Download file 817 Bytes
-
https://huggingface.co/spaces/s-eto-hub/firecrawl-api/resolve/main/apps/elixir-sdk/lib/firecrawl/error.ex
- Command line
-
hf download hf://spaces/s-eto-hub/firecrawl-api/apps/elixir-sdk/lib/firecrawl/error.ex
-
curl -L -o error.ex https://huggingface.co/spaces/s-eto-hub/firecrawl-api/resolve/main/apps/elixir-sdk/lib/firecrawl/error.ex
817 Bytes
| defmodule Firecrawl.Error do | |
| @moduledoc """ | |
| Exception raised when the Firecrawl API returns an error response (HTTP 4xx/5xx). | |
| ## Fields | |
| * `:status` - The HTTP status code | |
| * `:body` - The decoded response body (typically a map with `"error"` key) | |
| """ | |
| defexception [:status, :body] | |
| @type t :: %__MODULE__{ | |
| status: pos_integer(), | |
| body: term() | |
| } | |
| @impl true | |
| def message(%__MODULE__{status: status, body: body}) when is_map(body) do | |
| error_msg = | |
| case body["error"] || body["message"] do | |
| msg when is_binary(msg) -> msg | |
| _ -> inspect(body) | |
| end | |
| "Firecrawl API error (HTTP #{status}): #{error_msg}" | |
| end | |
| def message(%__MODULE__{status: status, body: body}) do | |
| "Firecrawl API error (HTTP #{status}): #{inspect(body)}" | |
| end | |
| end | |