This is a question of best practices and why. When I know there's a chance of a
specific error, I tend to code specifically to handle it. Others code generally
using try/catch. Which is seen as best in other languages and why? I doubt
there's any real performance issue between them, so it's a question of industry
standard and style.
For example, if I know an ID is needed on a page and it has to be a numeric I'd
do:
<CFIF Not IsDefined('ID')>
An ID is needed
<CFELSEIF Not IsNumeric(ID)>
The passed ID needs to be numeric
</CFIF>
Others do:
<CFTRY>
<cfparam name="ID" type="numeric">
<CFCATCH>
You must pass a numeric ID
</CFCATCH>
</CFTRY>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232328
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54