Jump to content

handling errors !


xploita

Recommended Posts

when coding.say that i call function UpdateLog() which must open a file,append to it then close it.

alot of errors could rise(file is not there,unable to write..etc).

which is better,to return a false value and handle the error outside the function UpdateLog(),or to end it right there inside the UpdateLog() function if it couldn't find/update the file?

 

regards

Link to comment
https://forums.phpfreaks.com/topic/46191-handling-errors/
Share on other sites

i agree with thorpe. if you're writing a class or a function, you probably use it more than once and for different apllications of that function, you might have to react differently based on the error.

 

thorpe mentioned exceptions in PHP 5 (i'm only just learning that :/), but if you're on PHP 4, try set_error_handler() and trigger_error()

Link to comment
https://forums.phpfreaks.com/topic/46191-handling-errors/#findComment-224986
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.