summary refs log tree commit diff
path: root/src/path/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/path/error.rs')
-rw-r--r--src/path/error.rs79
1 files changed, 0 insertions, 79 deletions
diff --git a/src/path/error.rs b/src/path/error.rs
deleted file mode 100644
index aee6e9f..0000000
--- a/src/path/error.rs
+++ /dev/null
@@ -1,79 +0,0 @@
-#![forbid(unsafe_code)]
-
-use crate::path::GenericPath;
-
-pub type Result<T> = std::result::Result<T, PathError>;
-
-
-#[derive(Clone,Debug,Eq,Hash,Ord,PartialEq,PartialOrd)]
-pub enum FileNameError {
-  ContainsSlash(String),
-}
-
-#[derive(Clone,Debug,Eq,Hash,Ord,PartialEq,PartialOrd)]
-pub enum DirectoryNameError {
-  ContainsSlash(String),
-}
-
-#[derive(Clone,Debug,Eq,Hash,Ord,PartialEq,PartialOrd)]
-pub enum PathError {
-  Parse(String),
-  PathLexicallyDirectory(GenericPath),
-  PathLexicallyRelative(GenericPath),
-  PathLexicallyInvalid(GenericPath),
-  PathListHasEmptyComponents(String),
-}
-
-
-impl std::error::Error for FileNameError { }
-
-impl std::error::Error for DirectoryNameError { }
-
-impl std::error::Error for PathError { }
-
-impl std::fmt::Display for FileNameError {
-  fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-    match self {
-      FileNameError::ContainsSlash(s) =>
-        f.write_fmt(format_args!(
-            "File names cannot contain slashes, but {:?} does.", s)),
-    }
-  }
-}
-
-impl std::fmt::Display for DirectoryNameError {
-  fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-    match self {
-      DirectoryNameError::ContainsSlash(s) =>
-        f.write_fmt(format_args!(
-            "File names cannot contain slashes, but {:?} does.", s)),
-    }
-  }
-}
-
-impl std::fmt::Display for PathError {
-  fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-    match self {
-      PathError::Parse(s) =>
-        f.write_fmt(format_args!("Syntax error in path: {}", s)),
-      PathError::PathLexicallyDirectory(path) =>
-        f.write_fmt(format_args!(
-            "The path {} ends in a slash, but is supposed to refer to a file, \
-             not a directory.",
-            path)),
-      PathError::PathLexicallyRelative(path) =>
-        f.write_fmt(format_args!(
-            "The path {} is relative, not absolute.",
-            path)),
-      PathError::PathLexicallyInvalid(path) =>
-        f.write_fmt(format_args!(
-            "This isn't a valid path. {}",
-            path)),
-      PathError::PathListHasEmptyComponents(path_list) =>
-        f.write_fmt(format_args!(
-            "Path list has empty components: {}",
-            path_list)),
-    }
-  }
-}
-