1
0
Fork 0
mirror of synced 2024-06-02 19:04:49 +12:00

feat: update error codes in the storage API

This commit is contained in:
Christy Jacob 2022-02-06 18:35:17 +04:00
parent 2c14abb143
commit 6a8401dfe5
3 changed files with 7 additions and 1 deletions

View file

@ -234,4 +234,9 @@ return [
'description' => 'The file size is either not valid or exceeds the maximum allowed size.',
'statusCode' => 400,
],
Exception::STORAGE_INVALID_FILE => [
'name' => Exception::STORAGE_INVALID_FILE,
'description' => 'The uploaded file is invalid. Please check the file and try again.',
'statusCode' => 403,
],
];

View file

@ -108,7 +108,7 @@ App::post('/v1/storage/files')
$device = Storage::getDevice('files');
if (!$upload->isValid($file['tmp_name'])) {
throw new Exception('Invalid file', 403, );
throw new Exception('Invalid file', 403, Exception::STORAGE_INVALID_FILE);
}
// Save to storage

View file

@ -66,6 +66,7 @@ class Exception extends \Exception
const STORAGE_INVALID_READ_PERMISSIONS = 'storage_invalid_read_permissions';
const STORAGE_INVALID_WRITE_PERMISSIONS = 'storage_invalid_write_permissions';
const STORAGE_INVALID_FILE_SIZE = 'storage_invalid_file_size';
const STORAGE_INVALID_FILE = 'storage_invalid_file';
/** Projects */
const PROJECT_NOT_FOUND = 'project_not_found';