Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino
On Fri, Jun 1, 2012 at 12:51 PM, Marco Behnke wrote: Ah, I guess that is the problem. Your application framework uses namespaces. > I guess you should try > > catch (\Exception $e) > > instead of > > catch (Exception $e) > > :-) > Ah, that was probably it. Will try it out tonight to confirm. T

Re: [PHP] Exception Handling

2012-06-01 Thread Marco Behnke
Am 01.06.12 17:08, schrieb James Colannino: > > Hey Marco, > > Thanks for the reply! That was the first thing I checked. > > class Database_Exception extends \FuelException {} > class Fuel_Exception extends \Exception {} > > It's extending Exception, as expected. Also, can you throw classes > tha

Re: [PHP] Exception Handling

2012-06-01 Thread FeIn
Maybe "catch(Exception $e)" should be "catch(\Exception $e)"? On Fri, Jun 1, 2012 at 5:25 PM, James Colannino wrote: > Hey guys, > > Haven't posted in a long time...  Happy Memorial Day!  I have an issue with > exception handling.  I'm using a framework that throws a > "Database_Exception" object

RE: [PHP] Exception Handling

2012-06-01 Thread Mackintosh, Mike
-Original Message- From: James Colannino [mailto:crankycycl...@gmail.com] Sent: Friday, June 01, 2012 11:14 AM To: PHP-General List Subject: Re: [PHP] Exception Handling Hey Mike, Thanks for the reply! I saw this comment in the documentation (http://www.php.net/manual/en

Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino
On 06/01/12 07:32, Mackintosh, Mike wrote: Hi James, You would have to catch Database_Exception. It is also good practice to also always catch exception afterwards. Hey Mike, Thanks for the reply! I saw this comment in the documentation (http://www.php.net/manual/en/language.exceptions.ext

Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino
On 06/01/12 08:08, James Colannino wrote: On 06/01/12 07:30, ma...@behnke.biz wrote: James Colannino hat am 1. Juni 2012 um 16:25 geschrieben: Hey guys, Haven't posted in a long time... Happy Memorial Day! I have an issue with exception handling. I'm using a framework that throws a "Databa

Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino
On 06/01/12 07:30, ma...@behnke.biz wrote: James Colannino hat am 1. Juni 2012 um 16:25 geschrieben: Hey guys, Haven't posted in a long time... Happy Memorial Day! I have an issue with exception handling. I'm using a framework that throws a "Database_Exception" object. I was expecting catc

RE: [PHP] Exception Handling

2012-06-01 Thread Mackintosh, Mike
-Original Message- From: James Colannino [mailto:crankycycl...@gmail.com] Sent: Friday, June 01, 2012 10:25 AM To: PHP-General List Subject: [PHP] Exception Handling Hey guys, Haven't posted in a long time... Happy Memorial Day! I have an issue with exception handling. I'm using a fra

Re: [PHP] Exception Handling

2012-06-01 Thread ma...@behnke.biz
James Colannino hat am 1. Juni 2012 um 16:25 geschrieben: > Hey guys, > > Haven't posted in a long time... Happy Memorial Day! I have an issue > with exception handling. I'm using a framework that throws a > "Database_Exception" object. I was expecting catch (Exception $var) to > be sufficie

Re: [PHP] Re: php exception handling

2009-10-12 Thread kranthi
cant http://us3.php.net/manual/en/function.set-exception-handler.php be used ? getMessage()); } set_exception_handler('exception_handler'); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: php exception handling

2009-10-11 Thread Al
Lars Nielsen wrote: Hi, I am trying to make an exception class that emails the errors to myself. I have started by using the example by ask at nilpo dot com on http://dk2.php.net/manual/en/language.exceptions.php. It work ok but i want it NOT to show the errors on the php-page but only show t

Re: [PHP] Exception handling with file()

2008-02-14 Thread Richard Lynch
On Mon, February 11, 2008 6:34 am, John Papas wrote: > I need to open a remote file with file() and I would like to put it > inside a try-catch but as far as I can tell file() does not raise an > exception if it fails. The following code: > > try { > $data = file('http://myserver.com

Re: [PHP] Exception handling with file()

2008-02-11 Thread Zoltán Németh
2008. 02. 11, hétfő keltezéssel 14.34-kor John Papas ezt írta: > I need to open a remote file with file() and I would like to put it > inside a try-catch but as far as I can tell file() does not raise an > exception if it fails. The following code: > > try { > $data = file('http://m

Re: [PHP] Exception handling in PHP

2008-02-07 Thread Richard Heyes
// ... That's from memory, so there may be a few errors. Seems there was. Try this: class DBException extends Exception {} try { $connection = mysql_connect(...); if (!$connection) { throw new DBException('Failed to connect to database'); } // Database exception handling

Re: [PHP] Exception handling in PHP

2008-02-07 Thread Richard Heyes
Does that mean for every exception do we have to write our custom exception and describe it from our own message If you mean "Do I have to write custom exception classes?", the no. You could just use the PHP Exception class. Eg. class DBException extends Exception {} try { $connection =

Re: [PHP] Exception handling in PHP

2008-02-07 Thread Paul Scott
On Thu, 2008-02-07 at 00:20 -0800, Prabath Kumarasinghe wrote: > Understood, Thanks Paul > Pleasure, but please don't top post, it makes it really hard to follow a thread easily. Most people on this list take time out from their really busy day jobs to help out, and the more time that everyone

Re: [PHP] Exception handling in PHP

2008-02-07 Thread Prabath Kumarasinghe
Understood, Thanks Paul Cheers Prabath --- Paul Scott <[EMAIL PROTECTED]> wrote: > > On Wed, 2008-02-06 at 23:37 -0800, Prabath > Kumarasinghe wrote: > > Does that mean for every exception do we have to > write > > our custom exception and describe it from our own > > message > > > > No, it me

Re: [PHP] Exception handling in PHP

2008-02-07 Thread Paul Scott
On Wed, 2008-02-06 at 23:37 -0800, Prabath Kumarasinghe wrote: > Does that mean for every exception do we have to write > our custom exception and describe it from our own > message > No, it means that when you want to throw a meaningful exception, you need to type in a message. I mentioned cust

Re: [PHP] Exception handling in PHP

2008-02-06 Thread Prabath Kumarasinghe
Does that mean for every exception do we have to write our custom exception and describe it from our own message Cheers Prabath --- Paul Scott <[EMAIL PROTECTED]> wrote: > > On Wed, 2008-02-06 at 23:10 -0800, Prabath > Kumarasinghe wrote: > > Is this following code work in PHP if > mysql_conne

Re: [PHP] Exception handling in PHP

2008-02-06 Thread Paul Scott
On Wed, 2008-02-06 at 23:10 -0800, Prabath Kumarasinghe wrote: > Is this following code work in PHP if mysql_connect > fails. > > try{ > mysql_connect('localhost','user',''); > > }catch(Exception $e){ > echo $e->getMessage(); > Probably not. I don't think that the mysql functions throw excep

Re: [PHP] Exception handling in PHP

2008-02-06 Thread Prabath Kumarasinghe
Hi Paul Is this following code work in PHP if mysql_connect fails. try{ mysql_connect('localhost','user',''); }catch(Exception $e){ echo $e->getMessage(); } Cheers Prabath --- Paul Scott <[EMAIL PROTECTED]> wrote: > > On Wed, 2008-02-06 at 22:52 -0800, Prabath > Kumarasinghe wrote: > > H

Re: [PHP] Exception handling in PHP

2008-02-06 Thread Paul Scott
On Wed, 2008-02-06 at 22:52 -0800, Prabath Kumarasinghe wrote: > Hi All > > I'm little bit confusing with PHP exception handling. > Could you able to explain how to put try{} and > catch(){} in a proper way in PHP. I had already read > php exception manual but it didn't help me to get > exact id

RE: [PHP] Exception Handling in php

2001-02-28 Thread Ovidiu EFTIMIE
I think that would be nice to have a try-catch to better control of the code. Ovidiu > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 27, 2001 9:09 PM > To: kevin1; [EMAIL PROTECTED] > Subject: Re: [PHP] Exception

Re: [PHP] Exception Handling in php

2001-02-27 Thread php3
Addressed to: kevin1 <[EMAIL PROTECTED]> [EMAIL PROTECTED] ** Reply to note from kevin1 <[EMAIL PROTECTED]> Tue, 27 Feb 2001 08:10:05 -0500 > > Is there any equivalent to Java's try-catch or Perl's eval{BLOCK}if($@) > structure in PHP? No. There has been some discussion about addi