mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Add NotSource
variant to FileError
This commit is contained in:
parent
fd8160f374
commit
0a0feb75fe
@ -184,10 +184,12 @@ pub type FileResult<T> = Result<T, FileError>;
|
|||||||
pub enum FileError {
|
pub enum FileError {
|
||||||
/// A file was not found at this path.
|
/// A file was not found at this path.
|
||||||
NotFound(PathBuf),
|
NotFound(PathBuf),
|
||||||
/// A directory was found, but a file was expected.
|
|
||||||
IsDirectory,
|
|
||||||
/// A file could not be accessed.
|
/// A file could not be accessed.
|
||||||
AccessDenied,
|
AccessDenied,
|
||||||
|
/// A directory was found, but a file was expected.
|
||||||
|
IsDirectory,
|
||||||
|
/// The file is not a Typst source file, but should have been.
|
||||||
|
NotSource,
|
||||||
/// The file was not valid UTF-8, but should have been.
|
/// The file was not valid UTF-8, but should have been.
|
||||||
InvalidUtf8,
|
InvalidUtf8,
|
||||||
/// Another error.
|
/// Another error.
|
||||||
@ -218,8 +220,9 @@ impl Display for FileError {
|
|||||||
Self::NotFound(path) => {
|
Self::NotFound(path) => {
|
||||||
write!(f, "file not found (searched at {})", path.display())
|
write!(f, "file not found (searched at {})", path.display())
|
||||||
}
|
}
|
||||||
Self::IsDirectory => f.pad("failed to load file (is a directory)"),
|
|
||||||
Self::AccessDenied => f.pad("failed to load file (access denied)"),
|
Self::AccessDenied => f.pad("failed to load file (access denied)"),
|
||||||
|
Self::IsDirectory => f.pad("failed to load file (is a directory)"),
|
||||||
|
Self::NotSource => f.pad("not a typst source file"),
|
||||||
Self::InvalidUtf8 => f.pad("file is not valid utf-8"),
|
Self::InvalidUtf8 => f.pad("file is not valid utf-8"),
|
||||||
Self::Other => f.pad("failed to load file"),
|
Self::Other => f.pad("failed to load file"),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user