Skip to content

Commit a1d0de2

Browse files
committed
NC | Add missing default rpc_code for unmapped errors
Signed-off-by: Romy <35330373+romayalon@users.noreply.github.com>
1 parent 95e739f commit a1d0de2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/util/native_fs_utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ function get_bucket_tmpdir_full_path(bucket_path, bucket_id) {
660660
/**
661661
* translate_error_codes we translate FS error codes to rpc_codes (strings)
662662
* and add the rpc_code property to the original error object
663+
* default rpc_code is internal error
663664
* @param {object} err
664665
* @param {('OBJECT'|'BUCKET'|'USER'|'ACCESS_KEY')} entity
665666
*/
@@ -671,7 +672,7 @@ function translate_error_codes(err, entity) {
671672
if (err.code === 'EEXIST') err.rpc_code = `${entity}_ALREADY_EXISTS`;
672673
if (err.code === 'EPERM' || err.code === 'EACCES') err.rpc_code = 'UNAUTHORIZED';
673674
if (err.code === 'IO_STREAM_ITEM_TIMEOUT') err.rpc_code = 'IO_STREAM_ITEM_TIMEOUT';
674-
if (err.code === 'INTERNAL_ERROR') err.rpc_code = 'INTERNAL_ERROR';
675+
if (err.code === 'INTERNAL_ERROR' || !err.rpc_code) err.rpc_code = 'INTERNAL_ERROR';
675676
return err;
676677
}
677678

0 commit comments

Comments
 (0)