Wrong line number errors for casting return types

<cffunction name="test" returntype="struct">
    <cfreturn "this will blow up">
</cffunction>

<cfscript>
    test(); //throws can't cast String [this will blow up] to a value of type [struct] on line 6
</cfscript>

doesn’t this error occur on line 2?

https://luceeserver.atlassian.net/browse/LDEV-1766

Nope. The error occurs where you call the function, not where the function is defined. These are run-time errors, not compile-time errors.

ACF works the same way… though, ironically, does give the wrong line number (5, instead of 6) but provides a clearer error message (The value returned from the test function is not of type struct. on line 5)

HTH

– Denny

1 Like

Hi @Zackster,

Lucee acts same as what ACF does. Issue arises while calling the function only not happened at compile time. This is handle at runtime only.

ok, can we at least improve the lucee’s error message?