RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TList.Error Method (PResStringRec, Integer)

Raises an EListError exception.

Pascal
class procedure Error(const Msg: string; Data: Integer); virtual; overload;
class procedure Error(Msg: PResStringRec; Data: Integer); overload;
C++
virtual __fastcall Error(const AnsiString Msg, int Data);
__fastcall Error(PResStringRec Msg, int Data);

Call Error to raise an exception when an error occurs working with a TList object. Error assembles an error message from the format string (or resource string) passed as the Msg parameter and the data value passed as the Data parameter, and then raises an EListError exception. 

Call Error rather than adding a line such as

Note: raise EListError.CreateFmt(MyMsg, iBadValue);
Note: or
Note: resourcestring sBadValueMessage = '%s not a valid list value';
Note: ...
Note: EListError.Create(@sBadValueMessage, iBadValue);
Note: throw EListError(MyMsg, iBadValue);
to reduce the code size of an application. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!