Clean up error handling
This commit is contained in:
@@ -34,13 +34,13 @@ impl IndexedImage {
|
||||
png::BitDepth::Four => IndexPerByte::TwoIndices,
|
||||
png::BitDepth::Eight => IndexPerByte::OneIndex,
|
||||
_ => {
|
||||
return Err(Error::from_str("Only 4 and 8bit color depth are supported").with_action(action_name));
|
||||
return Err(Error::from_text(format!("{}: Only 4 and 8bit color depth are supported", action_name)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if info.color_type != png::ColorType::Indexed {
|
||||
return Err(Error::from_str("PNG file must be indexed").with_action(action_name));
|
||||
return Err(Error::from_text(format!("{}: PNG file must be indexed", action_name)));
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -54,7 +54,7 @@ impl IndexedImage {
|
||||
}
|
||||
|
||||
Err(err) => {
|
||||
Err(Error::from_error(err).with_action(action_name))
|
||||
Err(Error::from_text(format!("{}: {}", action_name, err.to_string())))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user