[FX.php List] PHP question
Jonathan Schwartz
jschwartz at exit445.com
Fri Jul 18 10:13:28 MDT 2008
Good question, Mr. Patin.
My appreciation for properly designed error
handling has grown over time, because... "it all
depends".
It depends on which element of the process
fails, what stage the process was in, what you
would like the system to do, what you would like
the end user to see and what notification the
developer/admin should receive...to name a few.
Phew!
In your example, the php include() statement
would fail, but php would continue and pass the
process back to the web server. Depending on how
the errorreporting and displayerror parameters
were set, the browser might or might not display
the php error.
Dale's suggestion for detecting whether or not
the file exists is good . It delivers the user to
either a generic error page. An improved version
of that perhaps would be to trap for the missing
page and have that displayed on error page. At
least the user can report the problem with
specifics....if they chose.
An even more improved version would have the
system documenting the error to either a log file
or via email, or both.
GGT gave me with a script earlier this year. It
documents the current state of the server (GET,
POST, SESSION, Etc) and I have that generating an
email to me whenever it runs.
In my case, it has been invaluable to recover
from bonehead coding errors where I might have
accidentally generated a 102 error by messing
with the fields or field names. Instead of the
process failing to generate a new customer record
and then losing the data, the system documents
the data in both log file and email. I can
re-create the record after fixing the error.
As I said in the beginning, it all depends on the
process and where and how the process fails, and
what you'd like to do about it.
There is much much more to talk about on this subject, but I'll stop now. ;-)
Regards,
Jonathan
>I have a site where I'm including these static HTML pages; sometimes my
>client doesn't put the pages where he's supposed to, and so the page shows
>an error.
>
>If I have code like this:
>
>include_once($mypage);
>
>and the referenced page doesn't exist, is there a way to trap that and
>send the user to an error page instead?
>
>Thanks,
>
>Bob Patin
>Longterm Solutions
>bob at longtermsolutions.com
>615-333-6858
>http://www.longtermsolutions.com
>iChat: bobpatin
>AIM: longterm1954
>FileMaker 9 Certified Developer
>Member of FileMaker Business Alliance and FileMaker TechNet
>--------------------------
>FileMaker hosting and consulting for all versions of FileMaker
>PHP Full email services Free DNS hosting Colocation Consulting
>
>
>
>
>_______________________________________________
>FX.php_List mailing list
>FX.php_List at mail.iviking.org
>http://www.iviking.org/mailman/listinfo/fx.php_list
--
Jonathan Schwartz
Exit 445 Group
jonathan at exit445.com
http://www.exit445.com
415-370-5011
More information about the FX.php_List
mailing list