diff --git a/app/config/errors.php b/app/config/errors.php index c19255776..13264fbf5 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -196,6 +196,11 @@ return [ 'description' => 'The requested image could not be parsed.', 'statusCode' => 500, ], + Exception::AVATAR_REMOTE_URL_FAILED => [ + 'name' => Exception::AVATAR_REMOTE_URL_FAILED, + 'description' => 'The remote URL could not be fetched.', + 'statusCode' => 404, + ], /** Files */ diff --git a/app/controllers/api/avatars.php b/app/controllers/api/avatars.php index 7165e67c4..7b9c770eb 100644 --- a/app/controllers/api/avatars.php +++ b/app/controllers/api/avatars.php @@ -259,7 +259,7 @@ App::get('/v1/avatars/favicon') \curl_close($curl); if (!$html) { - throw new Exception('Failed to fetch remote URL', 404); + throw new Exception('Failed to fetch remote URL', 404, Exception::AVATAR_REMOTE_URL_FAILED); } $doc = new DOMDocument(); diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index 0c4a3b6d8..070e4f32c 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -57,6 +57,7 @@ class Exception extends \Exception const IMAGIC_EXTENSION_MISSING = 'imagic_extension_missing'; const AVATAR_IMAGE_NOT_FOUND = 'avatar_image_not_found'; const AVATAR_CANNOT_PARSE_IMAGE = 'avatar_cannot_parse_image'; + const AVATAR_REMOTE_URL_FAILED = 'avatar_remote_url_failed'; /** Files */ const FILE_NOT_FOUND = 'file_not_found';