System.ConvUtils.RaiseConversionError

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure RaiseConversionError(const AText: string);
procedure RaiseConversionError(const AText: string; const AArgs: array of const);

C++

extern DELPHI_PACKAGE void __fastcall RaiseConversionError(const System::UnicodeString AText)/* overload */;

Properties

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

Description

Raises an EConversionError exception.

Call RaiseConversionError to raise an EConversionError exception. Most applications do not need to call this method because most conversion errors are raised by the Convert function.

However, you might want to raise an EConversionError exception from a method you supply to the RegisterConversionType function for converting between a new conversion type and the base units of a conversion family. For example, if a unit of measurement does not permit negative values, you could check for negative values and call RaiseConversionError if an attempt is made to use one in a conversion.

AText is the error message for the exception that is raised. It can contain standard string formatting specifiers.

AArgs is a list of arguments that are supplied for the format specifiers in AText.

Note: In C++, Args_Size is the index of the last argument in AArgs. (One less than the number of elements).

See Also