mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-04-22 00:29:23 +02:00
Exception stack trace support also for normal JS and not only NodeJS
This commit is contained in:
parent
8bd9ed19c2
commit
5b1e486aba
@ -882,18 +882,14 @@ type
|
||||
TJSError = Class external name 'Error' (TJSObject)
|
||||
private
|
||||
FMessage: String; external name 'message';
|
||||
{$ifdef NodeJS}
|
||||
FStack: JSValue; external name 'stack';
|
||||
{$endif}
|
||||
Public
|
||||
Constructor new;
|
||||
Constructor new(Const aMessage : string);
|
||||
Constructor new(Const aMessage,aFileName : string);
|
||||
Constructor new(Const aMessage,aFileName : string; aLineNumber : NativeInt);
|
||||
Property Message : String Read FMessage;
|
||||
{$ifdef NodeJS}
|
||||
Property Stack: JSValue read FStack;
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
TJSPromise = class;
|
||||
|
@ -116,9 +116,7 @@ type
|
||||
private
|
||||
fMessage: String;
|
||||
fHelpContext: Integer;
|
||||
{$ifdef NodeJS}
|
||||
FNodeJSError: TJSError;
|
||||
{$endif}
|
||||
FJSError: TJSError;
|
||||
public
|
||||
class var
|
||||
LogMessageOnCreate : Boolean;
|
||||
@ -130,8 +128,9 @@ type
|
||||
function ToString: String; override;
|
||||
property HelpContext: Integer read fHelpContext write fHelpContext;
|
||||
property Message: String read fMessage write fMessage;
|
||||
property JSError: TJSError read FJSError write FJSError;
|
||||
{$ifdef NodeJS}
|
||||
property NodeJSError: TJSError read FNodeJSError write FNodeJSError;
|
||||
property NodeJSError: TJSError read FJSError write FJSError; deprecated 'Use JSError';
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
@ -3034,9 +3033,7 @@ end;
|
||||
constructor Exception.Create(const Msg: String);
|
||||
begin
|
||||
fMessage:=Msg;
|
||||
{$ifdef nodejs}
|
||||
FNodeJSError:=TJSError.new;
|
||||
{$endif}
|
||||
FJSError:=TJSError.new;
|
||||
if LogMessageOnCreate then
|
||||
Writeln('Created exception ',ClassName,' with message: ',Msg);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user