Skip to content

Commit

Permalink
Merge pull request #8625 from romayalon/romy-fix-default-rpc-code
Browse files Browse the repository at this point in the history
NC | Add missing default rpc_code for unmapped errors
  • Loading branch information
romayalon authored Dec 23, 2024
2 parents 95e739f + a1d0de2 commit 5bb3175
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/util/native_fs_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ function get_bucket_tmpdir_full_path(bucket_path, bucket_id) {
/**
* translate_error_codes we translate FS error codes to rpc_codes (strings)
* and add the rpc_code property to the original error object
* default rpc_code is internal error
* @param {object} err
* @param {('OBJECT'|'BUCKET'|'USER'|'ACCESS_KEY')} entity
*/
Expand All @@ -671,7 +672,7 @@ function translate_error_codes(err, entity) {
if (err.code === 'EEXIST') err.rpc_code = `${entity}_ALREADY_EXISTS`;
if (err.code === 'EPERM' || err.code === 'EACCES') err.rpc_code = 'UNAUTHORIZED';
if (err.code === 'IO_STREAM_ITEM_TIMEOUT') err.rpc_code = 'IO_STREAM_ITEM_TIMEOUT';
if (err.code === 'INTERNAL_ERROR') err.rpc_code = 'INTERNAL_ERROR';
if (err.code === 'INTERNAL_ERROR' || !err.rpc_code) err.rpc_code = 'INTERNAL_ERROR';
return err;
}

Expand Down

0 comments on commit 5bb3175

Please sign in to comment.