mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 20:39:13 +02:00
* Add Error.Message
This commit is contained in:
parent
a4c03016fc
commit
73867e47f9
@ -1080,13 +1080,17 @@ type
|
|||||||
|
|
||||||
IJSError = interface(IJSObject)
|
IJSError = interface(IJSObject)
|
||||||
['{80532C4D-CAD2-4C70-A4EA-01B29BB8C2C8}']
|
['{80532C4D-CAD2-4C70-A4EA-01B29BB8C2C8}']
|
||||||
|
function _getMessage : String;
|
||||||
|
property Message : string Read _getMessage;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TJSError }
|
{ TJSError }
|
||||||
|
|
||||||
TJSError = class(TJSObject,IJSError)
|
TJSError = class(TJSObject,IJSError)
|
||||||
|
function _getMessage : String;
|
||||||
public
|
public
|
||||||
class function Cast(const Intf: IJSObject): IJSError; overload;
|
class function Cast(const Intf: IJSObject): IJSError; overload;
|
||||||
|
property Message : string Read _GetMessage;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TJSPromiseResolver = function(const aValue: Variant): Variant of object;
|
TJSPromiseResolver = function(const aValue: Variant): Variant of object;
|
||||||
@ -1593,11 +1597,18 @@ end;
|
|||||||
|
|
||||||
{ TJSError }
|
{ TJSError }
|
||||||
|
|
||||||
|
function TJSError._getMessage: String;
|
||||||
|
begin
|
||||||
|
Result:=ReadJSPropertyUnicodeString('message');
|
||||||
|
end;
|
||||||
|
|
||||||
class function TJSError.Cast(const Intf: IJSObject): IJSError;
|
class function TJSError.Cast(const Intf: IJSObject): IJSError;
|
||||||
begin
|
begin
|
||||||
Result:=TJSError.JOBCast(Intf);
|
Result:=TJSError.JOBCast(Intf);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{ TJSJSON }
|
{ TJSJSON }
|
||||||
|
|
||||||
function TJSJSON.parse(const aJSON: UnicodeString): TJOB_JSValue;
|
function TJSJSON.parse(const aJSON: UnicodeString): TJOB_JSValue;
|
||||||
@ -2056,7 +2067,7 @@ begin
|
|||||||
Exit(Round(TJOB_Double(V).Value));
|
Exit(Round(TJOB_Double(V).Value));
|
||||||
if V is TJOB_String then
|
if V is TJOB_String then
|
||||||
begin
|
begin
|
||||||
if TryStrToInt(TJOB_STRING(V).Value,Result) then
|
if TryStrToInt64(TJOB_STRING(V).Value,Result) then
|
||||||
Exit
|
Exit
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
|
Loading…
Reference in New Issue
Block a user