Skip to content

Commit 38e7741

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 <yegorlz@amazon.co.uk>
1 parent 2247cc9 commit 38e7741

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/jailer/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,7 @@ fn main_exec() -> Result<(), JailerError> {
349349
fs::create_dir_all(env.chroot_dir())
350350
.map_err(|err| JailerError::CreateDir(env.chroot_dir().to_owned(), err))?;
351351
env.run()
352-
})
353-
.unwrap_or_else(|err| panic!("Jailer error: {}", err));
352+
})?;
354353
Ok(())
355354
}
356355

tests/integration_tests/security/test_jail.py

Lines changed: 4 additions & 4 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

@@ -115,7 +115,7 @@ def test_exec_file_not_exist(uvm_plain, tmp_path):
115115

116116
with pytest.raises(
117117
Exception,
118-
match=rf"Jailer error: {pseudo_exec_file_path} is not executable",
118+
match=rf"{pseudo_exec_file_path} is not executable",
119119
):
120120
test_microvm.spawn()
121121

0 commit comments

Comments
 (0)