[ABE.pm] first legitimate PHP question

Ricardo SIGNES perl.abe at rjbs.manxome.org
Tue Aug 12 18:17:13 PDT 2008


* Adriano Ferreira <aferreira at shopzilla.com> [2008-08-12T21:02:22]
> On Tue, Aug 12, 2008 at 9:45 PM, Ricardo SIGNES
> <perl.abe at rjbs.manxome.org> wrote:
> >
> > I have some code roughly in this form:
> >
> >  try {
> >    print "about to try\n";
> >    $x = y();
> >    print "done trying\n";
> >  } catch (Exception $e) {
> >    print "caught exception\n";
> >  }

Here is an actual failing piece of code:

  <?php

  try {
    print "about to fail...\n";
    $x = new stdClass();
    print "this will fail: $x";
  } catch (Exception $e) {
    print "caught!\n";
  }

  ?>

> A wild guess: if the PHP developers worked their exception model based
> on Java, it may be that this "catchable error" is a more generic thing
> than an exception, like Java Throwable, and then maybe you should use

Sadly, nope.  Thanks for the suggestion, though.

I hate that it says "Catchable fatal error", because otherwise I'd surmise that
I can't catch it.

-- 
rjbs


More information about the ABE-pm mailing list