feat: update error codes in the avatars API
This commit is contained in:
parent
534d541b1f
commit
f6599f545e
|
@ -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 */
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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';
|
||||
|
|
Loading…
Reference in a new issue