-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
10 changed files
with
165 additions
and
101 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
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
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 |
---|---|---|
@@ -1,46 +1,13 @@ | ||
//! Custom error types. | ||
use std::io; | ||
use std::path::PathBuf; | ||
use thiserror::Error; | ||
|
||
use crate::vobsub::NomError; | ||
|
||
/// A type representing errors that are specific to `subtile`. Note that we may | ||
/// normally return `Error`, not `SubError`, which allows to return other | ||
/// kinds of errors from third-party libraries. | ||
#[derive(Debug, Error)] | ||
pub enum SubError { | ||
/// Our input data ended sooner than we expected. | ||
#[error("Input ended unexpectedly")] | ||
IncompleteInput, | ||
|
||
/// We were unable to find a required key in an `*.idx` file. | ||
#[error("Could not find required key '{0}'")] | ||
MissingKey(&'static str), | ||
|
||
/// We could not parse a value. | ||
#[error("Could not parse: {0}")] | ||
Parse(String), | ||
|
||
/// We could not process a subtitle image. | ||
#[error("Could not process subtitle image: {0}")] | ||
Image(String), | ||
|
||
/// We have leftover input that we didn't expect. | ||
#[error("Unexpected extra input")] | ||
UnexpectedInput, | ||
|
||
/// If an error happen during parsing with `nom`. | ||
#[error("Parsing error.")] | ||
NomParsing(#[from] NomError), | ||
|
||
/// We could not read a file. | ||
#[error("Could not read '{path}'")] | ||
Io { | ||
/// Source error | ||
source: io::Error, | ||
/// Path of the file we tried to read | ||
path: PathBuf, | ||
}, | ||
/// Error with `VobSub` | ||
#[error("Error with VobSub")] | ||
VobSub(#[from] crate::vobsub::VobSubError), | ||
} |
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
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
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
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
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
Oops, something went wrong.