Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is there a way to trap errors from function in PHP

Status
Not open for further replies.

excession

Programmer
Sep 22, 2004
111
GB
I'm callig a few php function in a script (FTP_PUT) an osometimes get a fatal error (timeout) if the connection is slow. Is there a way I can trap the error so it doesn't get printed all over the screen? Something similar the java's try catch blocks.

 
but wouldn't that just supress all errors without me being able to 'catch' them and deal with them?

 
Yeah that's right.
There is really no error catching program, unless if you do have this:

if (!your function)
{
echo "Your function is not successful";
} else
{
echo "Your function is successful";
}

normally "your function" would return false if it fails.
 
ok, thats a good idea. Supress all error messages and then just catch the return values. although this won't really reveal why something broke, but is better than having horrid warnings splashed all across the screen lol

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top