mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-08-23 05:19:07 +02:00
* use reference to for exception handlers
This commit is contained in:
parent
d9238eb798
commit
27b6f1c5a3
@ -65,7 +65,7 @@ Procedure TErrorApp.Run;
|
||||
|
||||
begin
|
||||
// This will only work for the main program if you have set showUncaughtExceptions before rtl.run();
|
||||
// TJSHtmlButtonElement(Document.getElementById('btnhook')).OnClick:=@DoHook;
|
||||
TJSHtmlButtonElement(Document.getElementById('btnhook')).OnClick:=@DoHook;
|
||||
// These will not be caught (yet)
|
||||
TJSHtmlButtonElement(Document.getElementById('btn')).OnClick:=@DoRaise;
|
||||
// Uncomment this to set default exception handlers
|
||||
@ -73,7 +73,7 @@ begin
|
||||
|
||||
// Uncomment these to set special exception handlers
|
||||
// SetOnUnCaughtExceptionHandler(@DoPascalException);
|
||||
// SetOnUnCaughtExceptionHandler(@DoJSException);
|
||||
SetOnUnCaughtExceptionHandler(@DoJSException);
|
||||
|
||||
// Various ways to raise an exception.
|
||||
// DoRaiseJS;
|
||||
|
@ -315,8 +315,8 @@ type
|
||||
TOnGetEnvironmentString = function(Index: Integer): String;
|
||||
TOnGetEnvironmentVariableCount = function: Integer;
|
||||
TShowExceptionHandler = Procedure (Const Msg : String);
|
||||
TUncaughtPascalExceptionHandler = Procedure(aObject : TObject);
|
||||
TUncaughtJSExceptionHandler = Procedure(aObject : TJSObject);
|
||||
TUncaughtPascalExceptionHandler = reference to Procedure(aObject : TObject);
|
||||
TUncaughtJSExceptionHandler = reference to Procedure(aObject : TJSObject);
|
||||
|
||||
var
|
||||
OnGetEnvironmentVariable: TOnGetEnvironmentVariable;
|
||||
@ -326,10 +326,11 @@ var
|
||||
OnShowException : TShowExceptionHandler = nil;
|
||||
|
||||
// Set handlers for uncaught exceptions. These will call HookUncaughtExceptions
|
||||
// They return the old exception handler, if there was any.
|
||||
Function SetOnUnCaughtExceptionHandler(aValue : TUncaughtPascalExceptionHandler) : TUncaughtPascalExceptionHandler;
|
||||
Function SetOnUnCaughtExceptionHandler(aValue : TUncaughtJSExceptionHandler) : TUncaughtJSExceptionHandler;
|
||||
// Hook the rtl handler for uncaught exceptions. If any exception handlers were set, they will be called.
|
||||
// If none was set, the exceptions will be displayed using ShowException.
|
||||
// If none were set, the exceptions will be displayed using ShowException.
|
||||
Procedure HookUncaughtExceptions;
|
||||
|
||||
function GetEnvironmentVariable(Const EnvVar: String): String;
|
||||
|
Loading…
Reference in New Issue
Block a user