summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosselin Poiret <dev@jpoiret.xyz>2022-01-15 14:50:03 +0100
committerMathieu Othacehe <othacehe@gnu.org>2022-02-02 16:46:43 +0100
commit0a74509a696671580c8a7dc768d26f414748bab5 (patch)
tree9418dc4e3eb0ac47f2110fd23ed46b2125ba1e1f
parentaf59e53631fa9ca729db6dcf9838b5f4c67e27b7 (diff)
downloadguix-patches-0a74509a696671580c8a7dc768d26f414748bab5.tar
guix-patches-0a74509a696671580c8a7dc768d26f414748bab5.tar.gz
installer: Raise condition when mklabel fails.
* gnu/installer/parted.scm (mklabel): Do it. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
-rw-r--r--gnu/installer/parted.scm10
1 files changed, 8 insertions, 2 deletions
diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm
index c8bb73ee64..e33ef5f8fd 100644
--- a/gnu/installer/parted.scm
+++ b/gnu/installer/parted.scm
@@ -635,8 +635,14 @@ determined by MAX-LENGTH-COLUMN procedure."
(define (mklabel device type-name)
"Create a partition table on DEVICE. TYPE-NAME is the type of the partition
table, \"msdos\" or \"gpt\"."
- (let ((type (disk-type-get type-name)))
- (disk-new-fresh device type)))
+ (let* ((type (disk-type-get type-name))
+ (disk (disk-new-fresh device type)))
+ (or disk
+ (raise
+ (condition
+ (&error)
+ (&message (message (format #f "Cannot create partition table of type
+~a on device ~a." type-name (device-path device)))))))))
;;