luminol_result/
lib.rs

1// Copyright (C) 2024 Melody Madeline Lyons
2//
3// This file is part of Luminol.
4//
5// Luminol is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Luminol is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Luminol.  If not, see <http://www.gnu.org/licenses/>.
17//
18//     Additional permission under GNU GPL version 3 section 7
19//
20// If you modify this Program, or any covered work, by linking or combining
21// it with Steamworks API by Valve Corporation, containing parts covered by
22// terms of the Steamworks API by Valve Corporation, the licensors of this
23// Program grant you additional permission to convey the resulting work.
24
25use std::io;
26
27use thiserror::Error;
28
29#[derive(Debug, Error)]
30pub enum Error {
31    #[cfg(feature = "steamworks")]
32    #[error("Steam error: {0}\nPerhaps you want to compile yourself a free copy?")]
33    Steamworks(#[from] steamworks::SteamError),
34    #[error("Failed to install color-eyre hooks")]
35    ColorEyreInstall(#[from] color_eyre::eyre::InstallError),
36    #[error("I/O Error: {0}")]
37    Io(#[from] io::Error),
38    #[error("Temporary file error: {0}")]
39    TempFilePersist(#[from] tempfile::PersistError),
40    #[error("Image loader error: {0}")]
41    Image(#[from] image::ImageError),
42    #[cfg(target_arch = "wasm32")]
43    #[error("Failed to initialise tracing-log")]
44    Tracing(#[from] tracing_log::log::SetLoggerError),
45
46    #[error("Could not get path to the current executable")]
47    ExePathQueryFailed,
48    #[error("Egui context cell has been already set (this shouldn't happen!)")]
49    EguiContextCellAlreadySet,
50}
51
52pub type Result<T> = core::result::Result<T, Error>;