SnakeBridge.Error (SnakeBridge v0.11.0)
View SourceML-specific error types for SnakeBridge.
This module provides structured error types that translate Python/ML errors into Elixir exceptions with actionable suggestions.
Available Error Types
SnakeBridge.Error.ShapeMismatchError- Tensor shape incompatibilitiesSnakeBridge.Error.OutOfMemoryError- GPU/CPU memory exhaustionSnakeBridge.Error.DtypeMismatchError- Tensor dtype incompatibilities
Translation
Use SnakeBridge.ErrorTranslator to automatically translate Python
exceptions into these structured error types.
Examples
# Creating errors directly
error = SnakeBridge.Error.ShapeMismatchError.new(:matmul,
shape_a: [3, 4],
shape_b: [5, 6]
)
# Raising errors
raise SnakeBridge.Error.OutOfMemoryError, device: {:cuda, 0}
# Translating Python errors
translated = SnakeBridge.ErrorTranslator.translate(python_error)