feat: update error codes in the storage API
This commit is contained in:
parent
d9fbe80317
commit
4905792bb5
|
@ -241,7 +241,12 @@ return [
|
|||
],
|
||||
Exception::STORAGE_FAILED_TO_MOVE_FILE => [
|
||||
'name' => Exception::STORAGE_FAILED_TO_MOVE_FILE,
|
||||
'description' => 'Failed to copy the uploaded file.',
|
||||
'description' => 'Failed to move the uploaded file.',
|
||||
'statusCode' => 500,
|
||||
],
|
||||
Exception::STORAGE_FAILED_TO_WRITE_FILE => [
|
||||
'name' => Exception::STORAGE_FAILED_TO_WRITE_FILE,
|
||||
'description' => 'Failed to save the uploaded file.',
|
||||
'statusCode' => 500,
|
||||
],
|
||||
];
|
|
@ -141,7 +141,7 @@ App::post('/v1/storage/files')
|
|||
$data = OpenSSL::encrypt($data, OpenSSL::CIPHER_AES_128_GCM, $key, 0, $iv, $tag);
|
||||
|
||||
if (!$device->write($path, $data, $mimeType)) {
|
||||
throw new Exception('Failed to save file', 500);
|
||||
throw new Exception('Failed to save file', 500, Exception::STORAGE_FAILED_TO_WRITE_FILE);
|
||||
}
|
||||
|
||||
$sizeActual = $device->getFileSize($path);
|
||||
|
|
|
@ -68,6 +68,7 @@ class Exception extends \Exception
|
|||
const STORAGE_INVALID_FILE_SIZE = 'storage_invalid_file_size';
|
||||
const STORAGE_INVALID_FILE = 'storage_invalid_file';
|
||||
const STORAGE_FAILED_TO_MOVE_FILE = 'storage_failed_to_move_file';
|
||||
const STORAGE_FAILED_TO_WRITE_FILE = 'storage_failed_to_write_file';
|
||||
|
||||
/** Projects */
|
||||
const PROJECT_NOT_FOUND = 'project_not_found';
|
||||
|
|
Loading…
Reference in a new issue