Re: Exception misinformation

From: Date: Sun, 11 Jul 2004 19:55:46 +0000
Subject: Re: Exception misinformation
References: 1 2 3 4 5 6 7  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-31857@lists.php.net to get a copy of this message
Hans Lellelid wrote:
Hi Lukas,
I am wondering if we have come up with some magic to handle the following issue with exceptions. Currently using PEAR_Error I can build up a stack of expected errors which should not cause the standard error handling callback to be called and thereby let local error handling take over.
I'm not sure I understand this, can you provide/point to an exmple?
Well lets say the lib would create a set of exceptions which I want to demote to warnings or even ignore. Lets say there are 4 types of exceptions that I want to ignore or handle locally. which would mean try { // Normal execution code lines } catch (SomeException e) { // Exception handling code lines // Exception handling code lines } catch (SomeOtherException e) { // Exception handling code lines // Exception handling code lines } catch (SomeOtherOtherException e) { // Exception handling code lines // Exception handling code lines } catch (SomeOtherOtherOtherException e) { // Exception handling code lines // Exception handling code lines } try { // More normal execution code lines } catch (SomeException e) { // Exception handling code lines // Exception handling code lines } catch (SomeOtherException e) { // Exception handling code lines // Exception handling code lines } catch (SomeOtherOtherException e) { // Exception handling code lines // Exception handling code lines } catch (SomeOtherOtherOtherException e) { // Exception handling code lines // Exception handling code lines } whereas with PEAR_Error I would do: $this->expect(SomeOtherOtherOtherError) $this->expect(SomeOtherOtherOtherError) $this->expect(SomeOtherOtherOtherError) $this->expect(SomeOtherOtherOtherError) // Normal execution code lines // More normal execution code lines $this->popExpect() $this->popExpect() $this->popExpect() $this->popExpect() regards, Lukas Smith smith@backendmedia.com _______________________________ BackendMedia www.backendmedia.com berlin@backendmedia.com Linn Zwoch Smith GbR Pariser Str. 44 D-10707 Berlin Tel +49 30 83 22 50 00 Fax +49 30 83 22 50 07

« previous php.pear.dev (#31857) next »