JevDSL.Error exception (jev_dsl v0.1.0)

Copy Markdown View Source

Structured exception raised by evaluate!/3 and JevDSL.Runner.evaluate!/4 when a JevDSL contract evaluation fails.

Fields

  • :type - Error classification atom (:no_api_key, :cache_miss, :unknown_contract, :invalid_options, or :evaluation_failed).
  • :message - Human-readable error message.
  • :contract - The contract key (atom or string) being evaluated, if applicable.
  • :details - Additional error context or underlying failure term.

Summary

Functions

Builds a :cache_miss exception when cache_only: true is set and the evaluation is not in L1/L2 cache.

Converts an error reason from evaluate/3 into a raisable exception (JevDSL.Error or SystemOneSDK.Error).

Builds an :invalid_options exception when invalid options are supplied.

Builds a :no_api_key exception when neither a TYPESAFE_API_KEY nor an offline cache/mock is available.

Builds an :unknown_contract exception when a contract key is not defined on the module.

Types

error_type()

@type error_type() ::
  :no_api_key
  | :cache_miss
  | :unknown_contract
  | :invalid_options
  | :evaluation_failed

t()

@type t() :: %JevDSL.Error{
  __exception__: true,
  contract: atom() | String.t() | nil,
  details: term(),
  message: String.t(),
  type: error_type()
}

Functions

cache_miss(contract \\ nil)

@spec cache_miss(atom() | String.t() | nil) :: t()

Builds a :cache_miss exception when cache_only: true is set and the evaluation is not in L1/L2 cache.

from_reason(err, contract)

@spec from_reason(term(), atom() | String.t() | nil) :: Exception.t()

Converts an error reason from evaluate/3 into a raisable exception (JevDSL.Error or SystemOneSDK.Error).

invalid_options(message, details \\ nil)

@spec invalid_options(String.t(), term()) :: t()

Builds an :invalid_options exception when invalid options are supplied.

no_api_key(contract \\ nil)

@spec no_api_key(atom() | String.t() | nil) :: t()

Builds a :no_api_key exception when neither a TYPESAFE_API_KEY nor an offline cache/mock is available.

unknown_contract(module, contract)

@spec unknown_contract(module(), atom() | String.t()) :: t()

Builds an :unknown_contract exception when a contract key is not defined on the module.