dbTalk Databases Forums  

Custom task error handling

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Custom task error handling in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gauss9
 
Posts: n/a

Default 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

Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: Custom task error handling - 04-18-2004 , 11:50 AM






This may not seem right, but I find it works, just use a Err.Raise
instead of OnError events.

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.