-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
6f201fc
commit 348108c
Showing
8 changed files
with
492 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use std::path::PathBuf; | ||
|
||
use png::EncodingError; | ||
use tiff::TiffError; | ||
|
||
#[derive(thiserror::Error, Debug)] | ||
pub enum CogError { | ||
#[error("Couldn't decoded {1} as tiff file: {0}")] | ||
InvalidTifFile(TiffError, PathBuf), | ||
|
||
#[error("Requested zoom level:{0} from file {1} is out of range, the zoom level is from {2} to {3}")] | ||
ZoomOutOfRange(u8, PathBuf, u8, u8), | ||
|
||
#[error("Couldn't find any image(the tiff tag newsubfile is not mask) in the tiff file: {0}")] | ||
NoImagesFound(PathBuf), | ||
|
||
#[error("Couldn't seek to ifd number {1} (0 based indexing) in tiff file {2} : {0}")] | ||
IfdSeekFailed(TiffError, usize, PathBuf), | ||
|
||
#[error("Too many images in the tiff file: {0}")] | ||
TooManyImages(PathBuf), | ||
|
||
#[error("Couldn't find tags {1:?} at ifd {2} of tiff file {3} : {0}")] | ||
TagsNotFound(TiffError, Vec<u16>, usize, PathBuf), | ||
|
||
#[error("Planar configuration not equals to 1 is not supported, the tiff file is {2}")] | ||
PlanaConfigurationNotSupported(PathBuf, usize, u16), | ||
|
||
#[error("Failed to transform {1}th tile data at ifd {2} from {3} to png: {0}")] | ||
ToPngBytesFailed(TiffError, u32, usize, PathBuf), | ||
|
||
#[error("Failed to read {1}th chunk(0 based index) at ifd {2} from tiff file {3}: {0}")] | ||
ReadChunkFailed(TiffError, u32, usize, PathBuf), | ||
|
||
#[error("Failed to write header of png file at {0}, the color type is {1:?}, the bit depth is {2:?}: {3}")] | ||
WritePngHeaderFailed(PathBuf, png::ColorType, png::BitDepth, EncodingError), | ||
|
||
#[error("Failed to write pixel bytes to png file at {0}: {1}")] | ||
WriteToPngFailed(PathBuf, EncodingError), | ||
} |
Oops, something went wrong.