From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 307461F462 for ; Mon, 29 Jul 2019 07:56:46 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id BDEFD120959; Mon, 29 Jul 2019 16:56:38 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 6D7F7120907 for ; Mon, 29 Jul 2019 16:56:37 +0900 (JST) Received: by filter0063p3iad2.sendgrid.net with SMTP id filter0063p3iad2-13256-5D3EA6B5-20 2019-07-29 07:56:38.013079404 +0000 UTC m=+218380.855298296 Received: from herokuapp.com (unknown [3.80.72.87]) by ismtpd0003p1iad1.sendgrid.net (SG) with ESMTP id WeQnj0SDTAqfP42NZeL2JQ for ; Mon, 29 Jul 2019 07:56:37.954 +0000 (UTC) Date: Mon, 29 Jul 2019 07:56:38 +0000 (UTC) From: ko1@atdot.net Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 69487 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15558 X-Redmine-Issue-Author: Eregon X-Redmine-Issue-Assignee: Eregon X-Redmine-Sender: ko1 X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?fVTMYOBjtdvXNcWwrscBhLsHItUXVK5L4mtnq0mdcRc+=2Fb6m8CYQJRHa1pXYAG?= =?us-ascii?Q?bvlR8N6PQbTVv4p+M1aTFwFmAqbuZ4QEXbEMN0g?= =?us-ascii?Q?IUJ7rrG=2Fk+tj4E7nZiUxzzhaajrx+bpAlj=2Fj+7Y?= =?us-ascii?Q?Puyysdgbp4vLFsN8WFzt3Xs55Lb5QanSs2EKr36?= =?us-ascii?Q?OxbXHO6opY0U8?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 93982 Subject: [ruby-core:93982] [Ruby master Bug#15558] Should Exception#exception copy the backtrace? X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #15558 has been updated by ko1 (Koichi Sasada). I'm not sure the intention, but Japanese document shows how to use it: ``` # http://rurema.clear-code.com/2.6.0/method/Exception/i/exception.html begin ... # do something rescue => e raise e.exception("an error occurs during hogehoge process") # detailed message end ``` If this method is intended to be raised immediately, the empty backtrace is reasonable. ---------------------------------------- Bug #15558: Should Exception#exception copy the backtrace? https://bugs.ruby-lang.org/issues/15558#change-80175 * Author: Eregon (Benoit Daloze) * Status: Open * Priority: Normal * Assignee: Eregon (Benoit Daloze) * Target version: * ruby -v: ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- Currently it does not on MRI: ``` ruby -e 'begin raise "foo"; rescue => e; c=e.exception "bar"; p c.backtrace; end' nil ``` But it does on JRuby 9.2.5.0 and TruffleRuby 1.0.0-rc11: ``` truffleruby -e 'begin raise "foo"; rescue => e; c=e.exception "bar"; p e.backtrace; end' ["-e:1:in `
'"] ``` This means in some cases, code needs about this difference such as in https://github.com/asciidoctor/asciidoctor/blob/41da20a47a8da96966ef3ec1c2f509e07e7920e3/lib/asciidoctor.rb#L1322-L1338 More context in: https://github.com/oracle/truffleruby/issues/1542#issuecomment-456850066 -- https://bugs.ruby-lang.org/