ExceptObject Actually, it seems that ExceptObject is not defined in Pas2JS 2.1 |
Pas2JS pascal source code
type EMyExcept = class(Exception) end; { main.pas } Begin //--- TESTE I --- Try Raise Exception.Create('1'); Finally If Assigned(ExceptObject) Then Raise Exception.Create('2'); End; //--- TESTE II --- if ExceptObject <> nil then WriteLn('bug'); try raise Exception.Create('hello'); except WriteLn(ExceptObject.ClassName + ': ' + ExceptObject.Message); try raise EMyExcept.Create('world'); except on e: EMyExcept do begin WriteLn(e.ClassName + ': ' + e.Message); WriteLn(ExceptObject.ClassName + ': ' + ExceptObject.Message); if e <> ExceptObject then WriteLn('bug'); end; else WriteLn('bug'); end; WriteLn(ExceptObject.ClassName + ': ' + ExceptObject.Message); end; if ExceptObject <> nil then WriteLn('bug'); try try raise EMyExcept.Create('hello world'); finally WriteLn(ExceptObject.ClassName + ': ' + ExceptObject.Message); end; except WriteLn(ExceptObject.ClassName + ': ' + ExceptObject.Message); end; if ExceptObject <> nil then WriteLn('bug'); { <<< EXPECTED CONSOLE OUTPUTS >>> Exception: hello EMyExcept: world EMyExcept: world Exception: hello EMyExcept: hello world EMyExcept: hello world } //---> Uncaught ReferenceError: ExceptObject is not defined