error function ignores call level

Create issue
Issue #42 resolved
mezzodrinker created an issue

The Java side of the error function of MobTalkerScript looks like this:

@MtsNativeFunction( "error" )
public static void error( MtsVarargs args )
{
    throw new MtsRuntimeException( args.get( 0 ).toMtsString().toJava(),
                                   checkInteger( args, 1, 1 ) - 1 );
}

However, the constructor of MtsRuntimeException that allows the specification of a call level has the following signature:

public MtsRuntimeException(int level, String msg, Object... args)

Hence, a different constructor of MtsRuntimeException is called, which results in the call level parameter to be ignored (unless there's a %d in the error message).

Comments (4)

  1. Log in to comment