]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Show proper error if parsing history fails
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 21 Sep 2024 22:59:31 +0000 (00:59 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 22 Sep 2024 10:20:24 +0000 (12:20 +0200)
mkosi/config.py

index e11ef0106d0bfb46ddbd1ad00ac55d0cd9c74c83..18c9e76965e62bd6c523066c27d4bd6229eebc4f 100644 (file)
@@ -3955,7 +3955,13 @@ def parse_config(
         and not args.force
         and Path(".mkosi-private/history/latest.json").exists()
     ):
-        prev = Config.from_json(Path(".mkosi-private/history/latest.json").read_text())
+        try:
+            prev = Config.from_json(Path(".mkosi-private/history/latest.json").read_text())
+        except ValueError:
+            die(
+                "Unable to parse history from .mkosi-private/history/latest.json",
+                hint="Build with -f to generate a new history file from scratch",
+            )
 
         # If we're operating on a previously built image (qemu, boot, shell, ...), we're not rebuilding the
         # image and the configuration of the latest build is available, we load the config that was used to