pub enum Error {
UnsupportedFormat(String),
Corrupt(String),
LimitExceeded,
InvalidArgument(String),
DivisionByZero,
Failed(String),
}Expand description
Everything Image can fail with, one variant per PHP
exception class. The messages are the library’s own and say what the
caller can act on; what a codec reported is kept for Debug only.
PHP: Utopia\Image\Exception\ImageException and its subclasses for what an
image or the system makes fail, and \InvalidArgumentException for an
argument that could never work.
Variants§
UnsupportedFormat(String)
Data whose signature is not one of the Formats, an
output type that is not one, or a format this build has no codec for.
PHP: Utopia\Image\Exception\UnsupportedFormatException.
Corrupt(String)
Data of a known format that cannot be decoded; holds what the decoder
reported. PHP: Utopia\Image\Exception\CorruptImageException.
LimitExceeded
An image larger than its canvas’s Limits.
PHP: Utopia\Image\Exception\LimitExceededException.
InvalidArgument(String)
A focal point, colour or size that is not valid.
PHP: \InvalidArgumentException.
DivisionByZero
A crop whose target height rounds down to zero with a gravity other than
the centre or with a focal point. PHP: DivisionByZeroError.
Failed(String)
Anything else: an operation or encoder that failed, a file or directory
that could not be written. PHP: Utopia\Image\Exception\ImageException.
Implementations§
Source§impl Error
impl Error
Sourcepub fn php_class(&self) -> &'static str
pub fn php_class(&self) -> &'static str
The PHP exception class this error corresponds to.
use utopia_image::Error;
assert_eq!(Error::LimitExceeded.php_class(), "Utopia\\Image\\Exception\\LimitExceededException");use Utopia\Image\Exception\ImageException;
use Utopia\Image\Image;
try { new Image('not an image'); } catch (ImageException $e) { echo get_class($e), "\n"; }Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Forget for Error
impl Freeze for Error
impl Move for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more