I wanted to be lazy and throw with just types and ...
# cfml-general
I wanted to be lazy and throw with just types and then tack on a common message in the catch block. I'll just toss the message on in the throws themselves then 🙂 thanks!
Copy code
     * This function will convert a read-only struct to a writable one. In CF10, this is necessary for read-only CFCATCH objects if you want to manipulate them.
     * @data any       The "object" to convert to a normal struct
     * @return struct
    public struct function toRegularStruct(required any data) {
        // Just copy the passed in structure's elements into a new/normal struct object
        return structFilter(arguments.data, function() {
			return true;
👍 1
you can use that to make it behave 'normally'
nice! thank you 🙂
It's very bloody annoying that one cannot create one's own exceptions in CFML 😐
👍 1
or to modify them. If I want to lie to myself about what was thrown, that's on me 😄
Can you extend the built-in exception type somehow? Haven't tried.
Urgh. The challenge is that there's no uniform implementation for an exception in CFML: Lucee didn't follow CF's lead here so whilst CF throws a
when one goes
throw "something"
, Lucee throws a (shockingly poorly named)
. Also
, so no extending anyhow. That said, one could easily knock together one's own custom exceptions in Java. It does require doing Java (and I know a lot of CFMLers are allergic to pushing that particular boat out), but the Java knowledge required is minimal.