Migrate from String to properly typed TiffFormatError

This commit is contained in:
Felix Schütt committed 2018-09-13 13:20:50 +02:00
1 parent daf23f34a0
commit 2c6ca5459a
4 files changed
+38 -22

No files matched your search

+3 -5
View File
@@ -4,7 +4,7 @@ use std::io::{self, Read, Seek};
use std::collections::{HashMap};
use super::stream::{ByteOrder, SmartReader, EndianReader};
use ::{TiffError, TiffResult};
use ::{TiffError, TiffFormatError, TiffResult};
use self::Value::{Unsigned, List, Rational};
@@ -86,7 +86,7 @@ pub enum Type {
#[allow(unused_qualifications)]
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Value {
//Signed(i32),
Unsigned(u32),
@@ -98,9 +98,7 @@ impl Value {
pub fn into_u32(self) -> TiffResult<u32> {
match self {
Unsigned(val) => Ok(val),
val => Err(TiffError::FormatError(format!(
"Expected unsigned integer, {:?} found.", val
)))
val => Err(TiffError::FormatError(TiffFormatError::UnsignedIntegerExpected(val))),
}
}
pub fn into_u32_vec(self) -> TiffResult<Vec<u32>> {