Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93397 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71084 invoked from network); 19 May 2016 11:58:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 May 2016 11:58:22 -0000 Authentication-Results: pb1.pair.com header.from=tim@bastelstu.be; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tim@bastelstu.be; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain bastelstu.be designates 78.46.88.104 as permitted sender) X-PHP-List-Original-Sender: tim@bastelstu.be X-Host-Fingerprint: 78.46.88.104 xqk7.com Received: from [78.46.88.104] ([78.46.88.104:55125] helo=xqk7.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B0/00-05406-C5AAD375 for ; Thu, 19 May 2016 07:58:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20150712; t=1463659098; bh=k3Yn+CNwPH6qiwE20e4+xFiQcPJLEEu+0uYklo8DHeA=; h=Subject:To:References:From:Date:In-Reply-To:From; b=mvGnmu8MMBqcwiF86ayspqsggDQdkeIdKFIuuc1uJL1CObNiJGC0Biw9QSbpMCNkn eZzO3uicQ/Cxk+DDNL/aJoMRRYvaXJOvEvTCtZw22IGfd4acY7vR37/hdRy0d+qiOP 0/xx0udJ5B3ispo7AxmjWMyWmcvDiNborvo5WMOE= To: Rasmus Schultz , PHP internals References: Message-ID: <573DAA59.3030302@bastelstu.be> Date: Thu, 19 May 2016 13:58:17 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Exception::getLine() From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=c3=bcsterhus?=) On 19.05.2016 13:14, Rasmus Schultz wrote: > I know that I can dig in via e.g. > Exception::getStackTrace()[0]["line"] and pull the relevant > line-number myself, but I'm wondering why the line-number 2 is > relevant, important or interesting at all? If you are rethrowing exceptions inside the catch bloc: for ($code = 0; $code < 2; $code++) { try { throw new Exception('Message '.$code, $code); } catch (\Exception $e) { if ($e->getCode() > 0) { throw $e; } } } Inside the catch bloc I check whether the Exception code is one that can be handled at that place (code = 0), if not I rethrow the exception. If the line property would refer to the place where the exception was thrown I'd lose information in that case. Tim