1
0
Fork 0
mirror of synced 2024-06-26 18:20:43 +12:00

feat: update error codes in the avatars API

This commit is contained in:
Christy Jacob 2022-02-06 18:19:10 +04:00
parent 534d541b1f
commit f6599f545e
3 changed files with 7 additions and 1 deletions

View file

@ -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 */

View file

@ -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();

View file

@ -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';