-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstd_error.rs
35 lines (28 loc) · 1.09 KB
/
std_error.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// SPDX-FileCopyrightText: 2021 - 2024 Robin Vobruba <[email protected]>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
use crate::BoxError;
use thiserror::Error;
/// This serves to wrap/represent `std::**()` and `Option` return values as `Result`s,
/// like the one of [`std::fs::PathBuf::file_name()`], or [`std::OsStr::to_str()`].
#[derive(Error, Debug)]
pub enum Error {
#[error("Represents a `Option::None` value as an error.")]
None,
/// A required properties value could not be evaluated
#[error(r#"The file name ends in "..", and does therefore not represent a file/directory/valid path."#)]
PathNotAFile,
#[error(
"The string is not valid UTF-8, and can thus not be represented by a normal rust string."
)]
NotValidUtf8,
#[cfg(feature = "url_parse_error")]
#[error(transparent)]
InvalidUrl(#[from] url::ParseError),
/// Represents all cases of `std::io::Error`.
#[error(transparent)]
IO(#[from] std::io::Error),
/// Represents all other cases of `std::error::Error`.
#[error(transparent)]
Boxed(#[from] BoxError),
}