nl_tokens: Set up special error type constructors .
pl_tokens: function SetUpError ( error_function ) { % FunctionSetInstanceClassName ( error_function , 'Error' ) ; var name = error_function . name ; var prototype = new GlobalObject ( ) ; if ( name !== 'Error' ) { % InternalSetPrototype ( error_function , GlobalError ) ; % InternalSetPrototype ( prototype , GlobalError . prototype ) ; } % FunctionSetPrototype ( error_function , prototype ) ; % AddNamedProperty ( error_function . prototype , 'name' , <mask> , DONT_ENUM ) ; % AddNamedProperty ( error_function . prototype , 'message' , '' , DONT_ENUM ) ; % AddNamedProperty ( error_function . prototype , 'constructor' , error_function , DONT_ENUM ) ; % SetCode ( error_function , function ( m ) { if ( IS_UNDEFINED ( new . target ) ) return new error_function ( m ) ; try { captureStackTrace ( this , error_function ) ; } catch ( e ) { } // Define all the expected properties directly on the error // object. This avoids going through getters and setters defined // on prototype objects. if ( ! IS_UNDEFINED ( m ) ) { % AddNamedProperty ( this , 'message' , TO_STRING ( m ) , DONT_ENUM ) ; } } ) ; % SetNativeFlag ( error_function ) ; return error_function ; }