Reputation: 1333
the Application.cfc's onMissingTemplate
function is a great place to catch error if the user accesses a template in url which does not exists.
But as I have templates which dynamically include the other templates using cfinclude
tag. But but if this dynamically generated path does not exist coldfusion does not calls the onMissingTemplate
function.
Is there another way to do this?
Upvotes: 0
Views: 303
Reputation: 367
you could catch the error with a cfcatch:
<cftry>
<cfset x = 'templateName'>
<cfinclude template="#x#.cfm">
<cfcatch type="MissingInclude">
//Do something
</cfcatch>
</cftry>
Upvotes: 1