<https://trycf.com/gist/3ac938ad7f31c25f7ee62a962c...
# adobe
a
s
What exactly are you upset about with this, is it that you can put single quotes in the custom type or that you can't use the type attribute for any predefined error types other than "Application" ?
m
i am le confused
s
It does say in the docs that you can't use the other predefined error types (though lucee seems to let you do it), if that is what is upsetting Adam
e
Now I am confused more so by @Scott Bennett explanation, as per the Adobe docs for the tag https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-t/cfthrow.html as the default is "application" which is really application.customString in the example provided by Adam. The value of the application. expression is undefined, and just throwing quotes around it, just makes it a string.
s
Whatever you put in the Type attribute of the cfthrow tag can be caught specifically in a cfcatch tags type attribute... the various other error types that are predefined are listed in the cfcatch documentation https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-c/cfcatch.html
👍 1
so basically what it is saying that ACF doesn't let you set the cfthrow "type" attribute to any of these values: • database • template • security • object • missingInclude • expression • lock • searchengine
Seem ACF intended for you to only really specify type in cfthrow if you wanted to create a custom type
a
@Scott Bennett yes, nailed it. Where did you get that list of types, btw? I was finding the docs for
<cfthrow>
less helpful than they could be, in saying "Do not enter another predefined type". Cheers, but what are they, lads? That's where that list should be. Or a link to that list if wherever it is is a better place for them. But my "why?" question is "why is that restriction imposed?" How is it helpful? It's like Java saying "yeah nah you can't throw a java.lang.Exception cos I thought of that first!!"
s
They are listed in the cfcatch docs
a
Yeah, just saw your link, cheers. I think if the restriction is on the
<cfcatch>
tag they ought to be promoted there too, yeah?
s
Should definitely be in both
a
It's not the catch that's giving me the problem. Indeed the catch is expecting an "expression" exception, which is why I'm bloody trying to throw one!!
s
Maybe it’s a throwback from pre java cf versions?
a
It would also be entirely reasonable to be able to actively throw most of those other ones too, I think.
*some
e
It seems like JRUN would have worked as intended. Now I am going to have to go find my copy of Macromedia Coldfusion MX.
a
It's not allowed right back to at least CF5.
At least CF5's exception message is a bit clearer:
A CFTHROW tag cannot throw the predefined type expression as a custom exception type.
👍 1