System.Classes.TList.Error

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

class procedure Error(const Msg: string; Data: NativeInt); overload; virtual;
class procedure Error(Msg: PResStringRec; Data: NativeInt); overload;

C++

__classmethod virtual void __fastcall Error(const System::UnicodeString Msg, NativeInt Data)/* overload */;
__classmethod void __fastcall Error(System::PResStringRec Msg, NativeInt Data)/* overload */;

Properties

Type Visibility Source Unit Parent
procedure
function
public
System.Classes.pas
System.Classes.hpp
System.Classes TList

Description

Raises an EListError exception.

Call Error to raise an exception when an error occurs while 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


raise EListError.CreateFmt(MyMsg, iBadValue);

or

resourcestring sBadValueMessage = '%s not a valid list value';
  ...
EListError.Create(@sBadValueMessage, iBadValue);
throw EListError(MyMsg, iBadValue);

to reduce the code size of an application.


See Also