cell_model/error.rs
1// SPDX-License-Identifier: MIT
2// Copyright (c) 2025 Leif Rydenfalk – https://github.com/Leif-Rydenfalk/cell
3
4use alloc::string::String;
5use core::fmt;
6
7#[derive(Debug)]
8pub enum Error {
9 Protocol(String),
10 Transport(String),
11}
12
13impl fmt::Display for Error {
14 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15 match self {
16 Error::Protocol(s) => write!(f, "Protocol error: {}", s),
17 Error::Transport(s) => write!(f, "Transport error: {}", s),
18 }
19 }
20}
21
22#[cfg(feature = "std")]
23impl std::error::Error for Error {}