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