RE: [PHP] try - catch is not so clear to me...
| From: | Bob McConnell | Date: | Mon, 13 Apr 2009 17:40:29 +0000 |
| Subject: | RE: [PHP] try - catch is not so clear to me... | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-291439@lists.php.net to get a copy of this message | ||
From: Marc Steinert
> Basically try-catch gives you the ability to handle errors
> outside a class or method scope, by the
> calling instance.
> This comes in handy, if you are programming in an object
> orientated way and thus enables you to
> seperate error handling from the rest of your functionality.
> Means, your methods do only the things, they are meant to do,
> without bothering to handling occuring
> errors.
> Hope, that made things clearer.
You know, this is the first explanation of exceptions I have seen that
actually makes sense. I could never figure out what they were and why
they were. It always looked like it was just a special subset of errors,
a distinction without a difference, as it were. But looking at them as a
technique to move the handlers out of the mainline code actually shines
some real light on the subject.
Thank you,
Bob McConnell