- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
// avm+ specific utility method
public static function throwError(type:Class, index:uint, ... rest)
{
// This implements the same error string formatting as the native
// method PrintWriter::formatP(...) any changes to this method should
// also be made there to keep the two in sync.
var i=0;
var f=function(match, pos, string)
{
var arg_num = -1;
switch(match.charAt(1))
{
case '1':
arg_num = 0;
break;
case '2':
arg_num = 1;
break;
case '3':
arg_num = 2;
break;
case '4':
arg_num = 3;
break;
case '5':
arg_num = 4;
break;
case '6':
arg_num = 5;
break;
}
if( arg_num > -1 && rest.length > arg_num )
return rest[arg_num];
else
return "";
}
throw new type(Error.getErrorMessage(index).replace(/%[0-9]/g, f), index);
}