Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93403 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8033 invoked from network); 19 May 2016 20:30:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 May 2016 20:30:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=derokorian@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=derokorian@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.48 as permitted sender) X-PHP-List-Original-Sender: derokorian@gmail.com X-Host-Fingerprint: 209.85.218.48 mail-oi0-f48.google.com Received: from [209.85.218.48] ([209.85.218.48:35014] helo=mail-oi0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 86/D3-05406-2522E375 for ; Thu, 19 May 2016 16:30:10 -0400 Received: by mail-oi0-f48.google.com with SMTP id x19so148033641oix.2 for ; Thu, 19 May 2016 13:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=jGLXXbMj/dKNxBgs6vKI5rxOVDvfb8Pg5FzrkULiiYs=; b=tmDkEa9zLAydtpPpdFKFVpwZ2o57R6SZ4vzS6vXN0aE6ND8+3wK3IfWiDbBajT3coV EDix/skOMzg9Pb89S1+2/ZLDDIJoKiSuMk4HwlaZ2CnW1PBbiRCOM1ZWA6u5SPLKQ1P+ c3JNggw7psnT3Y0t07P+lfmm2njsYuKckxSrnv/ppiQwtV+x2wB2qq7tMlyc88djYNWS uU6eAFFugMOV7xmg7GFJUNkbhZ3LS6d30vlQauTRyrllL04F3GDr9jHwDPaP+aC+tMVA 5j5OJyp7Aunj+ATSJ9tQHASb7sMX8rj49w1zkNIvjU9EMSVWwQfC5nbg0ceOkHKN5qLh rqng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=jGLXXbMj/dKNxBgs6vKI5rxOVDvfb8Pg5FzrkULiiYs=; b=Ax5F2m6142ob703GqjduZ8rKPHQiM7bGrc6qjbGdgKHfNMDg9My0PiS9pSO8dOzUUq ke6K6Fo9S/i9sgb7gAklHrYapTTkHvhnh6crKjFvp3ruWIRpmeBc2Oq2gKhcR+4qcv4i lKayPuQ12CZ3/qC+NXhhHIaltgO6ytetwrrOJ4izAU6k1j4Tb3d411e/0iyZrDMJcLov IuqXon6LSzCNYOklIO3q8jInxqHP4GVpa0LlJoA4V3OfHgRzS2n2L2HKYKOReE+7Pgxt DHoAA90a0B5097oKVkRH4qPlC4mP8MuXI8AXLYAfTyfA/BAuN3oooJL1W1QNjBXlUPhB X+uw== X-Gm-Message-State: AOPr4FU6ECLKRAhz+FVdjjBiTwuhW8tekhQaoPx19eHbUo23AGv4aKQAGV8AdwbeQXyBCLIZeMcSQCXPCBHeTw== MIME-Version: 1.0 X-Received: by 10.157.5.209 with SMTP id 75mr9939109otd.60.1463689807123; Thu, 19 May 2016 13:30:07 -0700 (PDT) Received: by 10.157.37.57 with HTTP; Thu, 19 May 2016 13:30:07 -0700 (PDT) In-Reply-To: <914fa1d6-9fae-51b2-9246-526eb5c01bc7@gmail.com> References: <72f547d6-5fcf-3cd2-960d-cb612a429e47@php.net> <914fa1d6-9fae-51b2-9246-526eb5c01bc7@gmail.com> Date: Thu, 19 May 2016 14:30:07 -0600 Message-ID: To: Rowan Collins Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a1136f86603da4d053337d7ce Subject: Re: [PHP-DEV] Exception::getLine() From: derokorian@gmail.com (Ryan Pallas) --001a1136f86603da4d053337d7ce Content-Type: text/plain; charset=UTF-8 On Thu, May 19, 2016 at 1:47 PM, Rowan Collins wrote: > On 19/05/2016 19:35, Rasmus Schultz wrote: > >> Technically, every throw is a new exception "flow" - even if you're > >> recycling the Exception instance, it's the throw statement that > >> > starts the unique stack unwind from the throw site; it's where the > > action happens. > > That's one interpretation, but it doesn't really hold up in all cases. > Consider a catch statement that needs to filter more granularly than the > class name; since you already mentioned PDO, I'll make an example with that: > > catch ( PDOException $e ) { > if ( substr($e->getCode(), 0, 2) === '08' ) { > $this->reconnect(); > } else { > throw $e; > } > } > > Of what value to a subsequent catch statement is the trace of that throw > statement? And why does that "start a new exception flow", but if PDO threw > different sub-classes, you could let one flow through unmodified by > tightening the catch statement? > True, but if you instead of throwing the same exception, threw a new one, you could capture both stacks. But you can never get the stack from the throw point of something created elsewhere. catch ( PDOException $e ) { if ( substr($e->getCode(), 0, 2) === '08' ) { $this->reconnect(); } else { throw new PDOException($e->getMessage(), $e->getCode(), $e); } } > Regards, > -- > Rowan Collins > [IMSoP] > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a1136f86603da4d053337d7ce--