From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maxim Cournoyer Newsgroups: gmane.lisp.guile.bugs Subject: bug#60799: Bogus 'Error while printing exception' message when raising srfi-35 exception Date: Sat, 14 Jan 2023 09:52:55 -0500 Message-ID: <87a62ldv7c.fsf@gmail.com> References: <87v8l9ewcb.fsf@gmail.com> <87sfgdk1w7.fsf@elephly.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15771"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Cc: 60799-done@debbugs.gnu.org To: Ricardo Wurmus Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sat Jan 14 15:54:23 2023 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pGhvL-0003vI-G4 for guile-bugs@m.gmane-mx.org; Sat, 14 Jan 2023 15:54:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGhv1-0000H1-US; Sat, 14 Jan 2023 09:54:03 -0500 Original-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 1pGhv0-0000Gq-LH for bug-guile@gnu.org; Sat, 14 Jan 2023 09:54:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pGhv0-0000OL-Cz for bug-guile@gnu.org; Sat, 14 Jan 2023 09:54:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pGhuz-000867-Tf for bug-guile@gnu.org; Sat, 14 Jan 2023 09:54:01 -0500 Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-To: bug-guile@gnu.org Resent-Date: Sat, 14 Jan 2023 14:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 60799 X-GNU-PR-Package: guile Mail-Followup-To: 60799@debbugs.gnu.org, maxim.cournoyer@gmail.com, maxim.cournoyer@gmail.com Original-Received: via spool by 60799-done@debbugs.gnu.org id=D60799.167370798631059 (code D ref 60799); Sat, 14 Jan 2023 14:54:01 +0000 Original-Received: (at 60799-done) by debbugs.gnu.org; 14 Jan 2023 14:53:06 +0000 Original-Received: from localhost ([127.0.0.1]:53726 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGhu5-00084t-Km for submit@debbugs.gnu.org; Sat, 14 Jan 2023 09:53:06 -0500 Original-Received: from mail-qt1-f173.google.com ([209.85.160.173]:40538) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGhu3-00084N-Ro for 60799-done@debbugs.gnu.org; Sat, 14 Jan 2023 09:53:04 -0500 Original-Received: by mail-qt1-f173.google.com with SMTP id jr10so14082749qtb.7 for <60799-done@debbugs.gnu.org>; Sat, 14 Jan 2023 06:53:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=G/b46TVq7sjwks4NuLQ5mGcGTxOIQz6XB/T8xzI19lY=; b=Lj9ZFHuBNuuv4GHBfZdLqxp/waD2PSjkiQ1+fNcDowbxWZXEWu5C/ZGos1BDuLOivZ 02GKLO8etnZjUrUsnwrcQxag0wc30caZu7vjrHkX2VLPPL9g+fHuq8c/TDr1XkXw1lRk V7+sqxUrUz9cKMkfU0Duy7ShqTkd+6JBhqbbTvw4d2vkGh+ecApG5rdokgAuJ2s6lRnU w+/sQbGtd9oww+0CKzYr3wZNZAEPiHDBHMSb2UQ6uSFyhObucBZ+rs0Te2ydAluSv3tK srGL9wushHKNeK7vOz/OBm/QOJmzQ7ogEo0/g37Kaz1AbXp6Qjw7R+iY9N3UveSHfTvU 7ANA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=G/b46TVq7sjwks4NuLQ5mGcGTxOIQz6XB/T8xzI19lY=; b=s5/uLGgNefvyFQMw2W9xyxjTbQziGlajoHVt5NUoZFTBWfz2XHKcozs2VCdqUiaA/p f36mlnkJedlMKCqBtFKKrlhPWqLOaZgK1oePGGoaBAsdviOUwARlF76evuDbactmDsel PR8NLmMG+SCsgzjFeggmIYwUtRFQQA3KMl/GcWH0quWzW1DVM7EWSBuy5L4xiHTQHCBG iprBQNuEXN4NczB9PhbFhx5h3yf0xDs0vA1v70u4HNQciVe31UhKms8otWzddfRjMq61 5eIKr0vU0jxJL6PpMmVGu46yBqNimX5jDKQViWXcVfr1DR7soZO3tZdpDma3r0VbI9fv uBkA== X-Gm-Message-State: AFqh2kqg8W6JrxMMROe2zwNBM3zPy2IFq+0j4JITdPhslGTTbT7WXVzk fLQw8dE4kLSMEm6dqEQHnX6jNF1bhiKRRKkr X-Google-Smtp-Source: AMrXdXt+duUNHtabKbrFGEG4UARepirqkMO0RwXK2uHVOdmuTgdEVwVkQ+b5X+Yc1zUSPRQ2ZYeDMQ== X-Received: by 2002:a05:622a:a015:b0:3ad:797e:7314 with SMTP id jt21-20020a05622aa01500b003ad797e7314mr27900153qtb.1.1673707977550; Sat, 14 Jan 2023 06:52:57 -0800 (PST) Original-Received: from hurd (dsl-10-149-10.b2b2c.ca. [72.10.149.10]) by smtp.gmail.com with ESMTPSA id j7-20020a05620a410700b006cbe3be300esm480711qko.12.2023.01.14.06.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Jan 2023 06:52:56 -0800 (PST) In-Reply-To: <87sfgdk1w7.fsf@elephly.net> (Ricardo Wurmus's message of "Sat, 14 Jan 2023 08:25:29 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.bugs:10516 Archived-At: Hello Ricardo, Ricardo Wurmus writes: > Hi Maxim, > >> When raising a srfi-35 defined exception type like in the following, a >> generic (and unhelpful) "Error while printing exception" message is >> shown, with not even the exception type mentioned: >> >> (use-modules (srfi srfi-35)) >> >> (define-condition-type &platform-not-found-error &error >> platform-not-found-error?) >> >> (raise-exception &platform-not-found-error) >> >> >> Produces: >> >> Backtrace: >> In ice-9/boot-9.scm: >> 1752:10 5 (with-exception-handler _ _ #:unwind? _ # _) >> In unknown file: >> 4 (apply-smob/0 #) >> In ice-9/boot-9.scm: >> 724:2 3 (call-with-prompt _ _ #) >> In ice-9/eval.scm: >> 619:8 2 (_ #(#(#))) >> In ice-9/boot-9.scm: >> 2836:4 1 (save-module-excursion _) >> 4388:12 0 (_) >> >> ice-9/boot-9.scm:4388:12: Error while printing exception. >> >> This is probably not by design, right? > > Perhaps not, but conditions are expected to be raised with =E2=80=9Craise= =E2=80=9D: > > (use-modules (srfi srfi-34) (srfi srfi-35)) > > (define-condition-type &platform-not-found-error &error > platform-not-found-error?) > > (raise (condition (&platform-not-found-error))) > ice-9/boot-9.scm:1685:16: In procedure raise-exception: > ERROR: > 1. &platform-not-found-error Thanks for pointing that. The above with 'raise' doesn't produce the same output for my Guile 3.0.8: --8<---------------cut here---------------start------------->8--- (use-modules (srfi srfi-35)) (define-condition-type &platform-not-found-error &error platform-not-found-error?) (raise (condition (&platform-not-found-error))) ice-9/boot-9.scm:1685:16: In procedure raise-exception: Wrong type (expecting exact integer): #<&platform-not-found-error> --8<---------------cut here---------------end--------------->8--- Using 'raise-exception' instead of 'raise' fixes it for me: --8<---------------cut here---------------start------------->8--- (raise-exception (condition (&platform-not-found-error))) ice-9/boot-9.scm:1685:16: In procedure raise-exception: ERROR: 1. &platform-not-found-error Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. --8<---------------cut here---------------end--------------->8--- So my initial issue was attempting to raise on a type rather than an object (which works both ways in other languages such as Python). If I also import srfi-34, then it works as expected: --8<---------------cut here---------------start------------->8--- (use-modules (srfi srfi-34) (srfi srfi-35)) (define-condition-type &platform-not-found-error &error platform-not-found-error?) (raise (condition (&platform-not-found-error))) --8<---------------cut here---------------end--------------->8--- So my original confusing was that there exists a 'raise' procedure in Guile, which has nothing to do with exceptions (it's used to send a signal to the current process). What I'll take from this is to use exclusively 'raise-exception', which is not subject to the above srfi-34 vs builtin raise confusion. Closing, thanks for helping me untangle things! --=20 Thanks, Maxim