// SPDX-License-Identifier: Apache-2.0 // Copyright 2026 use thiserror::Error; #[derive(Debug, Error)] pub enum Error { #[error("mlx: {0}")] Mlx(String), #[error("DNA: {0}")] Dna(#[from] kei_runtime_core::DnaError), #[error("wrong platform: MLX requires macOS Apple Silicon")] WrongPlatform, } pub type Result = std::result::Result; impl From for Error { fn from(e: kei_llm_mlx::Error) -> Self { Error::Mlx(e.to_string()) } } impl From for kei_runtime_core::Error { fn from(e: Error) -> Self { match e { Error::Dna(e) => kei_runtime_core::Error::Dna(e), Error::WrongPlatform => kei_runtime_core::Error::Provider( "MLX requires macOS Apple Silicon".into() ), Error::Mlx(s) => kei_runtime_core::Error::Provider(format!("mlx: {s}")), } } }