Skip to content

Commit 424320b

Browse files
committed
feat(jailer): remove panic on errors
Remove explicit panic on error. Let the error be returned from the main. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent e6d4664 commit 424320b

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/jailer/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,7 @@ fn main_exec() -> Result<(), JailerError> {
347347
fs::create_dir_all(env.chroot_dir())
348348
.map_err(|err| JailerError::CreateDir(env.chroot_dir().to_owned(), err))?;
349349
env.run()
350-
})
351-
.unwrap_or_else(|err| panic!("Jailer error: {}", err));
350+
})?;
352351
Ok(())
353352
}
354353

tests/integration_tests/security/test_jail.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_empty_jailer_id(uvm_plain):
6969
# we can set an empty ID.
7070
with pytest.raises(
7171
ChildProcessError,
72-
match=r"Jailer error: Invalid instance ID: Invalid len \(0\); the length must be between 1 and 64",
72+
match=r"Invalid instance ID: Invalid len \(0\); the length must be between 1 and 64",
7373
):
7474
test_microvm.spawn()
7575

@@ -88,7 +88,7 @@ def test_exec_file_not_exist(uvm_plain, tmp_path):
8888

8989
with pytest.raises(
9090
Exception,
91-
match=rf"Jailer error: Failed to canonicalize path {pseudo_exec_file_path}:"
91+
match=rf"Failed to canonicalize path {pseudo_exec_file_path}:"
9292
rf" No such file or directory \(os error 2\)",
9393
):
9494
test_microvm.spawn()
@@ -102,7 +102,7 @@ def test_exec_file_not_exist(uvm_plain, tmp_path):
102102

103103
with pytest.raises(
104104
Exception,
105-
match=rf"Jailer error: {pseudo_exec_dir_path} is not a file",
105+
match=rf"{pseudo_exec_dir_path} is not a file",
106106
):
107107
test_microvm.spawn()
108108

0 commit comments

Comments
 (0)