From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id kEvSOMEA1WV8LQAA62LTzQ:P1 (envelope-from ) for ; Tue, 20 Feb 2024 20:42:58 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id kEvSOMEA1WV8LQAA62LTzQ (envelope-from ) for ; Tue, 20 Feb 2024 20:42:58 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1708458177; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=/6Nav0+2fY2buJjY/GS4hP5eh6OsLsql8QYP/kQnH3Y=; b=LBpoU+6iBLA5aHZgRfW+kjfZwuqY4y1Luk1Qy9F1zQ2fsI73xejWLBh3XUsy6/0XW1qzK0 JhZbRkE7lYTkK0M/2DkCuqZFsB5krW3oyjaFXVx6r2LlAQxgcSh7J6BPXtBMX2vPKez6UG qKRJf7K5AF2Z0Y86LJ8yNYewN6DcgCsmwOfEn3497K/B8x4P2uMHzZSppnQLR/bYxqB8NR RNVaDyG4ByWtBNlyIwkbbG+kuuX83hOP/wO3KQjFJo1F7GQMUxnX8DXbXG04QOa1o4jdyX WsQ8OmwCMYqy9RlXyCdgUYu2qrsGfHto0YVNLEuxL5g9dcT0cbrkrhx2SR17lw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1708458177; a=rsa-sha256; cv=none; b=Je7lFaAVR+VxtUpKCRw19gEbAWSIzhUTWrNocTKXDgebI/Zef3ucLx35kAcpUMV+sKmwzW 4USg86x87Sc6ikWMEEdPDADvNy7J18+I7NQl9y6NXoWv2mVty0XXLSw0X1ZT182UmqIHn6 NdbHs5MmA5+6r4gM5zE0jVcWwWsC9NPxZWArVxRQBiV8oruBVYXOkgko8yx36dOXA90gSy kpQImhxqD77eujfqtr72JrA1X4kO/g/CWnEEElZV1yo7XI65ePiF0qDqWMTL6E9iUk5bPD Ysir8755w0XYggYM77I6/CnjjPqqky5NVA0BP5xgNX29qAPorIt7yJWYWLzVNw== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CCAB221FA2 for ; Tue, 20 Feb 2024 20:42:57 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcW0q-0004Cq-Gx; Tue, 20 Feb 2024 14:42:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rcW0o-0004Br-J9 for guix-patches@gnu.org; Tue, 20 Feb 2024 14:42:42 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rcW0o-00015x-AT; Tue, 20 Feb 2024 14:42:42 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rcW19-0002ZV-45; Tue, 20 Feb 2024 14:43:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69291] [PATCH 3/5] scripts: substitute: Replace some leave calls with raise. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Tue, 20 Feb 2024 19:43:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69291 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69291@debbugs.gnu.org Cc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69291-submit@debbugs.gnu.org id=B69291.17084581809846 (code B ref 69291); Tue, 20 Feb 2024 19:43:03 +0000 Received: (at 69291) by debbugs.gnu.org; 20 Feb 2024 19:43:00 +0000 Received: from localhost ([127.0.0.1]:46677 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcW16-0002Yi-Ac for submit@debbugs.gnu.org; Tue, 20 Feb 2024 14:43:00 -0500 Received: from mira.cbaines.net ([212.71.252.8]:43158) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcW0y-0002Y0-BZ for 69291@debbugs.gnu.org; Tue, 20 Feb 2024 14:42:52 -0500 Received: from localhost (unknown [212.132.255.10]) by mira.cbaines.net (Postfix) with ESMTPSA id 0407A27BBE2 for <69291@debbugs.gnu.org>; Tue, 20 Feb 2024 19:42:30 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 17dacf27 for <69291@debbugs.gnu.org>; Tue, 20 Feb 2024 19:42:29 +0000 (UTC) From: Christopher Baines Date: Tue, 20 Feb 2024 19:42:25 +0000 Message-ID: <3a88dc8a8369278f86f3a51a99aa62d991ba997d.1708458147.git.mail@cbaines.net> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -1.61 X-Spam-Score: -1.61 X-Migadu-Queue-Id: CCAB221FA2 X-TUID: O/rJx7azAI1E These calls happen inside of with-error-handling, so the effect should be the same, but this opens up the possibility of using this code in a program that doesn't want to exit when one of these error conditions is met. Change-Id: I15d963615d85d419559fa0f4333fa4dc1dfbfd3b * guix/scripts/substitute.scm (download-nar, process-substitution): Use raise formatted-message rather than leave. Change-Id: Idd0880206b69e3903e19e0536b87d65a52c200d5 --- guix/scripts/substitute.scm | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index 575fa2a0b3..1875a4332d 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -495,8 +495,10 @@ (define* (download-nar narinfo destination #:keep-alive? #t #:buffered? #f)))) (else - (leave (G_ "unsupported substitute URI scheme: ~a~%") - (uri->string uri))))) + (raise + (formatted-message + (G_ "unsupported substitute URI scheme: ~a~%") + (uri->string uri)))))) (define (try-fetch choices) (match choices @@ -511,9 +513,11 @@ (define* (download-nar narinfo destination (G_ "Downloading ~a...~%") (uri->string uri))) (values port uri compression download-size)))) (() - (leave (G_ "no valid nar URLs for ~a at ~a~%") - (narinfo-path narinfo) - (narinfo-uri-base narinfo))))) + (raise + (formatted-message + (G_ "no valid nar URLs for ~a at ~a~%") + (narinfo-path narinfo) + (narinfo-uri-base narinfo)))))) ;; Delete DESTINATION first--necessary when starting over after a failed ;; download. @@ -678,8 +682,10 @@ (define* (process-substitution port store-item destination (cut valid-narinfo? <> acl)))) (unless narinfo - (leave (G_ "no valid substitute for '~a'~%") - store-item)) + (raise + (formatted-message + (G_ "no valid substitute for '~a'~%") + store-item))) (guard (c ((network-error? c) (when (http-get-error? c) -- 2.41.0