Skip to main content

tensogram_core/
error.rs

1// (C) Copyright 2026- ECMWF and individual contributors.
2//
3// This software is licensed under the terms of the Apache Licence Version 2.0
4// which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5// In applying this licence, ECMWF does not waive the privileges and immunities
6// granted to it by virtue of its status as an intergovernmental organisation nor
7// does it submit to any jurisdiction.
8
9use thiserror::Error;
10
11#[derive(Debug, Error)]
12pub enum TensogramError {
13    #[error("framing error: {0}")]
14    Framing(String),
15    #[error("metadata error: {0}")]
16    Metadata(String),
17    #[error("encoding error: {0}")]
18    Encoding(String),
19    #[error("compression error: {0}")]
20    Compression(String),
21    #[error("object error: {0}")]
22    Object(String),
23    #[error("io error: {0}")]
24    Io(#[from] std::io::Error),
25    #[error("hash mismatch: expected {expected}, got {actual}")]
26    HashMismatch { expected: String, actual: String },
27    #[error("remote error: {0}")]
28    Remote(String),
29}
30
31pub type Result<T> = std::result::Result<T, TensogramError>;