-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy patherror.rs
More file actions
39 lines (37 loc) · 1.46 KB
/
error.rs
File metadata and controls
39 lines (37 loc) · 1.46 KB
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
36
37
38
39
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
use rust_i18n::t;
use tempfile::PersistError;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum SshdConfigError {
#[error("{t}: {0}", t = t!("error.command"))]
CommandError(String),
#[error("{t}: {0}", t = t!("error.configInitRequired"))]
ConfigInitRequired(String),
#[error("{t}: {0}", t = t!("error.envVar"))]
EnvVarError(#[from] std::env::VarError),
#[error("{t}", t = t!("error.fileNotFound", path = .0))]
FileNotFound(String),
#[error("{t}: {0}", t = t!("error.fmt"))]
FmtError(#[from] std::fmt::Error),
#[error("{t}: {0}", t = t!("error.invalidInput"))]
InvalidInput(String),
#[error("{t}: {0}", t = t!("error.io"))]
IOError(#[from] std::io::Error),
#[error("{t}: {0}", t = t!("error.json"))]
Json(#[from] serde_json::Error),
#[error("{t}: {0}", t = t!("error.language"))]
LanguageError(#[from] tree_sitter::LanguageError),
#[error("{t}: {0}", t = t!("error.parser"))]
ParserError(String),
#[error("{t}: {0}", t = t!("error.parseInt"))]
ParseIntError(#[from] std::num::ParseIntError),
#[error("{t}: {0}", t = t!("error.persist"))]
PersistError(#[from] PersistError),
#[cfg(windows)]
#[error("{t}: {0}", t = t!("error.registry"))]
RegistryError(#[from] dsc_lib_registry::error::RegistryError),
#[error("{t}: {0}", t = t!("error.stringUtf8"))]
StringUtf8Error(#[from] std::str::Utf8Error),
}