-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d007201
commit 640c885
Showing
2 changed files
with
44 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use std::path::PathBuf; | ||
|
||
use thiserror::Error; | ||
|
||
|
||
#[derive(Error, Debug)] | ||
pub enum Error { | ||
#[error(transparent)] | ||
Io(#[from] ::std::io::Error), | ||
#[error(transparent)] | ||
StripPrefix(#[from] ::std::path::StripPrefixError), | ||
#[error("{0} is not a directory")] | ||
NotDir(PathBuf), | ||
#[error("output path already exists: {0}")] | ||
OutputPathExists(PathBuf), | ||
#[error("{0} has invalid unicode")] | ||
InvalidUnicode(PathBuf), | ||
#[error("could not find default name from {0}")] | ||
CannotDetectDefaultName(PathBuf), | ||
#[error("parsing error due to invalid iro flags {0}")] | ||
InvalidIroFlags(i32), | ||
#[error("failed to parse binary data")] | ||
CannotParseBinary(nom::Err<::nom::error::Error<Vec<u8>>>), | ||
#[error("parsing error due to invalid file flags {0}")] | ||
InvalidFileFlags(i32), | ||
#[error("invalid utf16 {0}")] | ||
InvalidUtf16(String), | ||
#[error("parten file path does not exists: {0}")] | ||
ParentPathDoesNotExist(PathBuf), | ||
} | ||
|
||
impl From<nom::Err<nom::error::Error<&[u8]>>> for Error { | ||
fn from(err: nom::Err<nom::error::Error<&[u8]>>) -> Self { | ||
Self::CannotParseBinary(err.map_input(|input| input.into())) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters