Page 1 of 1

unvisible exceptions

Posted: Thu Jul 03, 2008 3:18 am
by ls-l
don't know why when I type

Code: Select all

<?php
    throw new Exception('a');
    
?>
doesn't return any code, just white page... Every exception works like this (or rather doesn't work), don't know why, if it's fail of apache or php...

Re: unvisible exceptions

Posted: Thu Jul 03, 2008 3:40 am
by kilermedia
You need to setup the handler first. It's printing nothing because you haven't set it to anything.

See PHP.net for details.

Re: unvisible exceptions

Posted: Thu Jul 03, 2008 3:46 am
by ls-l
thank you

and is it possible to put it somewhere in configuration files so that I wouldn't have to put it let's say 'everywhere'

Re: unvisible exceptions

Posted: Thu Jul 03, 2008 3:51 am
by shiznatix
If you use a bootstrap file you can set it there so it will always be set. That would be the easiest way. Or if you have some file that you include every page hit then throw it in there.

Re: unvisible exceptions

Posted: Thu Jul 03, 2008 3:53 am
by ls-l
ok, that's what I thought about, but I meant editing php.ini or similar file so that my code wouldn't have that line
it's because I'm working over team project and don't want to dirt global code