feat: update error codes in the storage API
This commit is contained in:
parent
2c14abb143
commit
6a8401dfe5
|
@ -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,
|
||||
],
|
||||
];
|
|
@ -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
|
||||
|
|
|
@ -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';
|
||||
|
|
Loading…
Reference in a new issue