summaryrefslogtreecommitdiff
path: root/support/texlab/src/workspace.rs
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-01-07 03:03:02 +0000
committerNorbert Preining <norbert@preining.info>2021-01-07 03:03:02 +0000
commit1dad166b3cb710b4aa32b8c21b91dbca02b2e408 (patch)
tree42319d2798d99252db2f4341dc6da986d22c5d53 /support/texlab/src/workspace.rs
parent0d181c27aefe5974e97590a4619967a462a5bfe0 (diff)
CTAN sync 202101070303
Diffstat (limited to 'support/texlab/src/workspace.rs')
-rw-r--r--support/texlab/src/workspace.rs35
1 files changed, 6 insertions, 29 deletions
diff --git a/support/texlab/src/workspace.rs b/support/texlab/src/workspace.rs
index 914510dddc..c3c2551325 100644
--- a/support/texlab/src/workspace.rs
+++ b/support/texlab/src/workspace.rs
@@ -9,15 +9,14 @@ use log::{debug, error, warn};
use petgraph::{graph::Graph, visit::Dfs};
use std::{
collections::HashMap,
- error,
ffi::OsStr,
- fmt,
hash::{Hash, Hasher},
io,
path::{Path, PathBuf},
sync::Arc,
time::SystemTime,
};
+use thiserror::Error;
use tokio::fs;
#[derive(Debug, PartialEq, Eq, Clone)]
@@ -307,36 +306,14 @@ impl Snapshot {
}
}
-#[derive(Debug)]
+#[derive(Debug, Error)]
pub enum WorkspaceLoadError {
+ #[error("invalid language id")]
UnknownLanguage,
+ #[error("invalid file path")]
InvalidPath,
- IO(io::Error),
-}
-
-impl From<io::Error> for WorkspaceLoadError {
- fn from(why: io::Error) -> Self {
- Self::IO(why)
- }
-}
-
-impl fmt::Display for WorkspaceLoadError {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- match self {
- Self::UnknownLanguage => write!(f, "Invalid language ID"),
- Self::InvalidPath => write!(f, "Invalid file path"),
- Self::IO(why) => write!(f, "{}", why),
- }
- }
-}
-
-impl error::Error for WorkspaceLoadError {
- fn source(&self) -> Option<&(dyn error::Error + 'static)> {
- match self {
- Self::UnknownLanguage | Self::InvalidPath => None,
- Self::IO(why) => why.source(),
- }
- }
+ #[error("an I/O error occurred: `{0}`")]
+ IO(#[from] io::Error),
}
pub struct Workspace {