[haXe] Request: more descriptive exception when calling a null
function reference
Nicolas Cannasse
ncannasse at motion-twin.com
Thu Dec 14 12:29:25 CET 2006
> Hi Nicolas and List,
>
> public static function main ():Void {
> var func:Bool -> Void = null;
> func(true);
> }
>
> The above compiles successfully but throws the exception "Invalid
> call". Of course, in this case it is obvious why; the value of 'func'
> is null, and using null as a function pointer is not a good idea.
>
> However, in the case that it is not immediately obvious to the
> programmer that the problem is caused by a null reference, the error
> message is not particularly helpful. Could the message possibly be
> changed to something a bit more descriptive, e.g. "Invalid call: null
> reference"?
This is not a good idea to print any value in exceptions, for security
reasons. Let's say that some users can figure out a way to make your
website raise this kind of exceptions, it could be used to display some
values (passwords) that should not be visible unless explicitly printed.
Nicolas
More information about the Haxe
mailing list