Skip to main content

morphir_core/
error.rs

1//! Error types for Morphir models
2//!
3//! This module provides error handling following functional programming principles
4//! with clear error types and composable error handling.
5
6use thiserror::Error;
7
8/// Result type alias for Morphir operations
9pub type Result<T> = std::result::Result<T, Error>;
10
11/// Main error type for Morphir model operations
12#[derive(Error, Debug)]
13pub enum Error {
14    #[error("IO error: {0}")]
15    Io(#[from] std::io::Error),
16
17    #[error("JSON parsing error: {0}")]
18    Json(#[from] serde_json::Error),
19
20    #[error("Invalid Morphir IR: {0}")]
21    InvalidIr(String),
22
23    #[error("Validation error: {0}")]
24    Validation(String),
25
26    #[error("Not implemented: {0}")]
27    NotImplemented(String),
28}