The OnError Event indicates and provides information about an error. Set Cancel to True to stop execution.
object.OnError(
EventSource,
ErrorCode,
Source,
Description,
HelpFile,
HelpContext,
IDofInterfaceWithError,
pbCancel)
Part | Description |
---|---|
Package | An expression that evaluates to an object in the Applies To list |
EventSource | Event being executed |
ErrorCode | Error code of the failure |
Source | Source of error message |
Description | Description property |
HelpFile | Help file name |
HelpContext | Help context ID |
IDOfInterfaceWithError | ID of the interface returning the error |
Cancel | Whether to cancel execution |
The OnError event is during Package object Execute method execution. An error can be raised by a DTS component or by executing a task. When an error occurs in execution, the OnError event is raised before return from the Execute method.
Event arguments are evaluated based on the source of the error message provided in the Source argument. Custom task objects may provide additional information to the application through the ErrorSource¸ ErrorCode, HelpFile, HelpContext, and IDOfInterfaceWithError arguments.
Use the Cancel argument to direct package execution on error. When Cancel is True (default), execution of the package is terminated on return from the application error handler. When Cancel is False, DTS attempts to execute the next task indicated.
The OnError event is raised on each error occurring in a task or step. A DTS object can support nonterminal errors. For example, the MaximumErrorCount property of the DataPumpTask object configures task error counting, allowing the task to continue execution after a nonterminal error.
For task types defined by DTS, the EventSource argument indicates a task by name. DTS tasks can be unnamed. When an error is raised by an unnamed task, the EventSource argument is empty.
HRESULT OnError(BSTR EventSource,
long ErrorCode,
BSTR Source,
BSTR Description,
BSTR HelpFile,
long HelpContext,
BSTR IDofInterfaceWithError,
BOOL *pbCancel);