Custom task error handling -
04-06-2004
, 01:34 PM
Hello,
I have a strange problem with my error handling.
I've started out with code found in the SQL Server 2000 DTS book.
The error handler looks like this:
-------
EH:
'Bubble any errors to the package eventsink
If Not pPackageEvents Is Nothing Then
pPackageEvents.OnError msTaskName & _
" - CustomTask_Execute method", Err.Number, Err.Source,
Err.Description, "", 0, "", True
End If
' For testing purpose...
pTaskResult = DTSTaskExecResult_Failure
MsgBox "result: " & pTaskResult
Exit Sub
-------
The message shown in the DTS gui is only correct when setting
pTaskResult to DTSTaskExecResult_Success.
It seams like the DTSTaskExecResult_Failure destroys the error shown
in the DTS GUI.
When the msgbox (MsgBox "result: " & pTaskResult) is shown.
The DTS gui waits until I press ok.
If I don't press ok and double click on the failure in the gui it
displays the complete error message. If i click ok and then double
click to check the error it displays "The task reported failure on
execution".
The only way to get the correct message to show is to always set the
pTaskResult to DTSTaskExecResult_Success.
Am I missing something here or is this the correct behaviour?
Best Regards,
Stefan |