I would like to create an error handling system in our
application. but I just cant get a simple prototype to work as it
should.
lets say, I want to handle two kinds of errors by throwing
exceptions. in case of the sendToDev exception I want an email to
be sent to the developers. In case of the sendToSupport exception I
want an email to be sent to the support.
Therefore, I define two kind of cferrors:
<cferror type="exception"
exception="sendToDev"
mailto="dev@foobar.com"
template="handleError.cfm">
<cferror type="exception"
exception="sendToSupport"
mailto="support@foobar.com"
template="handleError.cfm">
on the handleError.cfm the mailto-attribute will be used to
generate the email to the right adress.
so far for the cferror-definitions in application.cfm. now
the throwing inside of some function in a cfc:
<cfif [condition]>
<cfthrow type="sendToDev" message="an error occured. mail
to developers has been sent">
<cfelse>
<cfthrow type="sendToSupport" message="an error occured.
mail to supporters has been sent">
</cfif>
my understanding of this:
depending on what I've defined as "type" when throwing the
exception, the according cferror-tag should be used by the
application. but it doesnt. whatever the condition is and whatever
exception is thrown, it's allways the last defined cferror-tag
which will be used by the application. in the described case, the
sendToSupport-cferror will be used whatever is thrown. if i would
define the sendToSupport-cferror first in the application-file, the
sendToDev would be used.
any help here? i just dont get it :-(
regards
steven