xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

ErrorNew()

Creates a new Error object and optionally fills it with data.

Syntax

ErrorNew( [<cSubSystem>  ], ;
          [<nGenCode>    ], ;
          [<nSubCode>    ], ;
          [<cOperation>  ], ;
          [<cDescription>], ;
          {<aArgs>       ], ;
          [<cModuleName> ], ;
          [<cProcName>   ], ;
          [<nProcLine>   ]  ) --> oError

Arguments

<cSubSystem>
A character string that is assigned to oError:subSystem. Defaults to NIL.
<nGenCode>
A numeric value that is assigned to oError:genCode. Defaults to NIL.
<nSubCode>
A numeric value that is assigned to oError:subCode. Defaults to NIL.
<cOperation>
A character string that is assigned to oError:operation. Defaults to NIL.
<cDescription>
A character string that is assigned to oError:description. Defaults to NIL.
<aArgs>
An array that is assigned to oError:args. Defaults to NIL.
<ModuleName>
A character string that is assigned to oError:modulName. Defaults to ProcFile(1).
<cProcName>
A character string that is assigned to oError:procName. Defaults to ProcName(1).
<nProcLine>
A numeric value that is assigned to oError:procLine. Defaults to ProcLine(1).

Return

The function returns the new Error object with the passed parameters assigned to instance variables.

Description

ErrorNew() creates a new Error object and optionally assigns the parameters passed to instance variables of the object. The function is automatically called by the xHarbour runtime system when a runtime error occurs. User defined routines can create their own Error objects and fill them with error information. The Error object is then passed to the error code block (see ErrorBlock()) or to the Throw() function.

Error objects are instances of the Error() class. Refer to that class for more information on creating user defined Error objects.

Info

See also:Error(), ErrorBlock(), Throw(), TRY...CATCH
Category: Error functions , Object functions
Header:error.ch
Source:rtl\terror.prg
LIB:xhb.lib
DLL:xhbdll.dll

Example

// refer to the Error() class for an Error object example

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe