Re: Exceptions - when and why?
- From: lawpoop <lawpoop@xxxxxxxxx>
- Date: Thu, 4 Dec 2008 07:45:41 -0800 (PST)
Now that I've chomped this over a bit, I could do something like:
<?php
... whole bunch of stuff ...
try {
$myObj =& new objClass();
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
if ( $myObj-> useable == 1 ) {
... object code goes here ...
}
... rest of code ...
?>
I guess the whole reason this seem inelegant to me is that I would
like to do something like:
try {
$myObj =& new objClass();
} if ( catch (Exception $e) ) {
echo 'Caught exception: ', $e->getMessage(), "\n";
} else {
... object code goes here ...
}
Thoughts...?
.
- References:
- Exceptions - when and why?
- From: lawpoop
- Exceptions - when and why?
- Prev by Date: Re: [PHP] Last working day of a month
- Next by Date: Re: [PHP] Using DateTimeZone
- Previous by thread: Exceptions - when and why?
- Next by thread: Using DateTimeZone
- Index(es):
Relevant Pages
|