yengine/engine/error.rs
1use thiserror::Error;
2
3/// A handy [`std::fmt::Result`] alias with the [`enum@Error`] type.
4pub type Result<T, E = Error> = std::result::Result<T, E>;
5
6/// An error that may occur when interracting with the engine.
7#[derive(Debug, Error)]
8pub enum Error {
9 /// An I/O error occured.
10 #[error("I/O error: {0}")]
11 Io(#[from] std::io::Error),
12
13 /// An error occured while (de)-serializing messages.
14 #[error("format error: {0}")]
15 Format(#[from] crate::format::Error),
16
17 /// The data stream was closed before expected.
18 #[error("got an unexpected end of stream from engine")]
19 UnexpectedEof,
20}