Skip to content

Commit

Permalink
Rewrite exception messages for methods in AbstractDecoder
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Jun 26, 2024
1 parent bbf0f9f commit f3a3897
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Drivers/Gd/Decoders/AbstractDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ protected function getMediaTypeByFilePath(string $filepath): MediaType
$info = @getimagesize($filepath);

if (!is_array($info)) {
throw new DecoderException('Unable to decode input');
throw new DecoderException('Unable to detect media (MIME) from data in file path.');
}

if (!array_key_exists('mime', $info)) {
throw new DecoderException('Unable to decode input');
throw new DecoderException('Unable to detect media (MIME) from data in file path.');
}

return MediaType::from($info['mime']);
Expand All @@ -45,11 +45,11 @@ protected function getMediaTypeByBinary(string $data): MediaType
$info = @getimagesizefromstring($data);

if (!is_array($info)) {
throw new DecoderException('Unable to decode input');
throw new DecoderException('Unable to detect media (MIME) from binary data.');
}

if (!array_key_exists('mime', $info)) {
throw new DecoderException('Unable to decode input');
throw new DecoderException('Unable to detect media (MIME) from binary data.');
}

return MediaType::from($info['mime']);
Expand Down

0 comments on commit f3a3897

Please sign in to comment.