Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93408 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51909 invoked from network); 20 May 2016 07:22:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 May 2016 07:22:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.161 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.161 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.161] ([81.169.146.161:21611] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2B/C7-05406-32BBE375 for ; Fri, 20 May 2016 03:22:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1463728928; l=7301; s=domk; d=kelunik.com; h=Content-Type:Cc:To:From:Subject:Date:References:In-Reply-To: MIME-Version; bh=7p892jOuKOz04ME7Ak6aJg2OY5WIxrlTtl+AeJXhNIs=; b=CMKDmtkgQ3np8tNw1WgOZolAGS+Po9W8BocEt1YNVl+OvuE008VOhAdbugZxGiOnMGU 52aAcPlwwdW76wUf1f1gse+w5nSCDHAo11LgdO6UhKCsTYFdqfWfXYK9UYsOB4aBec7vO WD9oP6YkXRoc67HMgS/nxjsXPLs6x0Eo33M= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLGvomb4bl9EfHtO3U6 X-RZG-CLASS-ID: mo00 Received: from mail-wm0-f46.google.com ([74.125.82.46]) by smtp.strato.de (RZmta 37.27 AUTH) with ESMTPSA id t03935s4K7M8691 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp384r1 with 384 ECDH bits, eq. 7680 bits RSA)) (Client did not present a certificate) for ; Fri, 20 May 2016 09:22:08 +0200 (CEST) Received: by mail-wm0-f46.google.com with SMTP id a17so158959040wme.0 for ; Fri, 20 May 2016 00:22:08 -0700 (PDT) X-Gm-Message-State: AOPr4FXCjTQvabFoV28Y5/8wnz06rCpN3XKUOoYyiJnUp1DnEijAP/25Lg6dueqSrGZBNnGLfy6pnnQOSaAKCA== MIME-Version: 1.0 X-Received: by 10.194.113.194 with SMTP id ja2mr1626381wjb.13.1463728927928; Fri, 20 May 2016 00:22:07 -0700 (PDT) Received: by 10.28.53.132 with HTTP; Fri, 20 May 2016 00:22:07 -0700 (PDT) In-Reply-To: References: <72f547d6-5fcf-3cd2-960d-cb612a429e47@php.net> Date: Fri, 20 May 2016 09:22:07 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Jesse Schalken Cc: Rasmus Schultz , Sebastian Bergmann , PHP internals Content-Type: multipart/alternative; boundary=001a1130cf14cbfb6d053340f22a Subject: Re: [PHP-DEV] Exception::getLine() From: me@kelunik.com (Niklas Keller) --001a1130cf14cbfb6d053340f22a Content-Type: text/plain; charset=UTF-8 2016-05-20 4:13 GMT+02:00 Jesse Schalken : > > On Fri, May 20, 2016 at 4:35 AM, Rasmus Schultz > wrote: > >> This is inconsistent with at least JavaScript and C#, where the stack >> trace is populated at the throw site. (Probably others?) >> > > I'm not sure about C#, but in JavaScript (Node.js): > > function get_error() { > return new Error('my error'); > } > > function do_throw(e) { > throw e; > } > > try { > do_throw(get_error()); > } catch (e) { > console.log(e.stack); > } > > > results in: > > Error: my error > at get_error (/home/jesse/src/test.js:2:12) > at Object. (/home/jesse/src/test.js:10:14) > at Module._compile (module.js:413:34) > at Object.Module._extensions..js (module.js:422:10) > at Module.load (module.js:357:32) > at Function.Module._load (module.js:314:12) > at Function.Module.runMain (module.js:447:10) > at startup (node.js:146:18) > at node.js:404:3 > > > The top frame is the construction (get_error) and the site of the throw > (do_throw) doesn't appear in the stack at all. > The comparison with JavaScript isn't a good one, since you can throw everything in JS. If they didn't provide the stack trace upon throw, you would not have a stack trace at all if you throw a plain string. --001a1130cf14cbfb6d053340f22a--