Packages

A unified Elixir client for multiple AI providers including Vertex AI, OpenAI, Anthropic, AWS Bedrock, and local PyTorch models.

Current section

Files

Jump to
axiom_ai lib python_interface error.ex
Raw

lib/python_interface/error.ex

defmodule PythonInterface.Error do
@moduledoc """
An exception raised when Python raises an exception.
"""
defexception [:type, :value, :traceback]
@type t :: %{
type: PythonInterface.Object.t(),
value: PythonInterface.Object.t(),
traceback: PythonInterface.Object.t()
}
@impl true
def message(error) do
lines = PythonInterface.NIF.format_exception(error)
lines =
Enum.map(lines, fn line ->
[" ", line]
end)
IO.iodata_to_binary(["Python exception raised\n\n", lines])
end
end