Current section

Files

Jump to
bingex lib bingex api error.ex
Raw

lib/bingex/api/error.ex

defmodule Bingex.API.Error do
@moduledoc """
Represents an error that occurs within the BingX API.
This module defines a custom exception struct for handling API-related errors,
encapsulating the reason for the failure.
"""
@type t() :: %__MODULE__{reason: term()}
defexception [:reason]
@impl true
def exception(reason) when is_atom(reason) do
%__MODULE__{reason: reason}
end
@impl true
def message(%__MODULE__{reason: reason}) do
"#{reason}"
end
end