1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-15 10:23:59 +02:00

Rewrite exception messages for methods in AbstractDecoder

This commit is contained in:
Oliver Vogel
2024-06-26 17:38:27 +02:00
parent bbf0f9f821
commit f3a38975db

View File

@@ -23,11 +23,11 @@ abstract class AbstractDecoder extends SpecializableDecoder implements Specializ
$info = @getimagesize($filepath); $info = @getimagesize($filepath);
if (!is_array($info)) { 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)) { 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']); return MediaType::from($info['mime']);
@@ -45,11 +45,11 @@ abstract class AbstractDecoder extends SpecializableDecoder implements Specializ
$info = @getimagesizefromstring($data); $info = @getimagesizefromstring($data);
if (!is_array($info)) { 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)) { 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']); return MediaType::from($info['mime']);