Skip to main content

chaste_bun/
error.rs

1// SPDX-FileCopyrightText: 2025 The Chaste Authors
2// SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause
3
4use std::io;
5
6#[derive(Debug, thiserror::Error)]
7#[non_exhaustive]
8pub enum Error {
9    #[error("Unknown lockfile version: {0}")]
10    UnknownLockfileVersion(u8),
11
12    #[error("Invalid package key: {0:?}")]
13    InvalidKey(String),
14
15    #[error("Invalid package descriptor: {0:?}")]
16    InvalidDescriptor(String),
17
18    #[error("Dependency {0:?} not found")]
19    DependencyNotFound(String),
20
21    #[error("Invalid package data variant in key {0:?}")]
22    InvalidVariant(String),
23
24    #[error("Data variant mismatched with source/version marker in key {0:?}")]
25    VariantMarkerMismatch(String),
26
27    #[error("I/O error: {0:?}")]
28    IOError(#[from] io::Error),
29
30    #[error("JSONC error: {0:?}")]
31    JSONCError(#[from] json5::Error),
32
33    #[error("Chaste error: {0:?}")]
34    ChasteError(#[from] chaste_types::Error),
35
36    #[error("Chaste error: {0:?}")]
37    SSRIError(#[from] chaste_types::ssri::Error),
38}
39
40pub type Result<T, E = Error> = std::result::Result<T, E>;