]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
sandbox: use ValueError
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 9 Sep 2024 13:34:29 +0000 (15:34 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 12 Sep 2024 15:32:13 +0000 (17:32 +0200)
RuntimeError is for "unexpected errors". When the argument has a
wrong value, ValueError is the standard exception to use.

mkosi/sandbox.py

index b146627627b7d3f0a93bc11f9a22a9c638d5ec46..0df5aecfe981623a53f88224975237f2c4693bff 100755 (executable)
@@ -702,7 +702,7 @@ def main() -> None:
         elif arg == "--unshare-ipc":
             unshare_ipc = True
         elif arg.startswith("-"):
-            raise RuntimeError(f"Unrecognized option {arg}")
+            raise ValueError(f"Unrecognized option {arg}")
         else:
             argv.append(arg)
             break
@@ -714,7 +714,7 @@ def main() -> None:
     # Make sure all destination paths are absolute.
     for fsop in fsops:
         if fsop.dst[0] != "/":
-            raise RuntimeError(f"{fsop.dst} is not an absolute path")
+            raise ValueError(f"{fsop.dst} is not an absolute path")
 
     fsops = FSOperation.optimize(fsops)