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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error handling and include files

Status
Not open for further replies.

spiveygb

Programmer
Jun 24, 2003
27
0
0
US
I have two asp files (file1 and file2). "File1" is used as an include on "File2." "File2" is also dependent on successful processing of "File1." What happens if "File1" generates an error? I have an error handler in "File2" and am curious as to whether it would catch the error. What is the best way to go about error handling in this scenario? Should I create another asp file with an error handler and use that as an include file in "file 1" and "file 2?" Any insight would be greatly appreciated. Thanks.
 
When you use an #include, the text from the included file is literally just copy/pasted into the main page and then executed as part of that. Therefore, any error handler will pick up errors from both pages as in reality they become one page when it is processed.

Hope that makes sense!

--James
 
That's what I thought. However, I am having trouble getting the error handler to catch the error in the first file. I put the error handler into the first file it catches it just fine. If I continue to have an issue I'll post it up. Thx.
 
depends on where you're doing your includes and how your code is layed out if it's a bunch of functions that's one thing, if the includes are top to bottom code and you're including the error handling at the end, then you're not going to get the results from the error handling you're wanting, like James had noted, where you put your SSI at in your code you essentially copy pasted all of that page at that point, so make sure you error handling is before either of the pages are dealt with
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top