OnError Event Handler

  • Hi,

    I have a package which calls Package1 and Package2. I have implemented an event handler which fires OnError,

    I have a ExecuteSQL task that logs the Error into a table.

    There is an error in Package1. But in the table I could see that there are two entries.

    When I used breakpoints to debug I could see that the eventhandler is being called twice.

    It shows me the same behavior for both OnError and OnTaskFailed events.

    Please advice..

    Thanks and Regards,

    Praveena.

  • Is the error being logged by one of the child packages and then rolling up to the parent package and being logged again?

  • I am logging it both in the child package and parent package, ON Error. But the package Names will be different in the rows. And after running the package I see a total of 4 entries in the table.

    ChildPackage Failed

    ParentPackage Failed

    ChildPackage Failed

    ParentPackage Failed

    I tried both On Task failed and OnError and it shows the same behavoir.

    Thanks and Regards,

    Praveena.

  • venus.pvr (12/13/2010)


    Hi,

    I have a package which calls Package1 and Package2. I have implemented an event handler which fires OnError,

    I have a ExecuteSQL task that logs the Error into a table.

    There is an error in Package1. But in the table I could see that there are two entries.

    When I used breakpoints to debug I could see that the eventhandler is being called twice.

    Praveena,

    This is very normal. These OnError event handler will trigger on every error encountered during the package life cycle.

    One approach would be to to use a sequence container encapsulate your package and apply appropriate handlers on Seq Cont. Also do not forget ton set appropriate properties of SEQ container and it's child packages

    Raunak J

  • Raunak,

    I have one error in the parent package and one error in the child package. In that case the handler should be only called once for the parent package and once for the child package. But the handler is invoked two times for the parent package and two times for the child package. Is this a normal behavior. Or is there any property that needs to be set to the packages?

    Thanks and Regards,

    Praveena.

  • Raunak/Daniel,

    In my parent package, the child packages are all executed in a sequence container. And probably that is the reason why it records the error twice, once for the Execute package task and other for the sequence container.

    Is there any way I could avoid it? I have 12 child packages that execute one after the other in the Sequence container. The constraint between the Execute Package task packages is "On Completion".

    I need one entry for each of the child packages on error.

    Thanks and Regards,

    Praveena

  • Hi Praveena

    Do you know the use of propagate variable in SSIS?

    If we are using the event handler for eg.OnError for ExecutePackageTask1 and error Occures in ExecutePackageTask1 then the OnError event will be fired for the task that genatates the error and then the error will be propagated to it's parent container or task in a hierarchial fashion.

    If you set Propagate variable value of ExecutePackageTask1 to false then the error will not be propagated to it's parent.

    To set the value of propagate value follow the following steps

    Select the ExecutePackageTask1

    select the EventHandler tab

    Click the "Show System Variables" icon from the window that displays list of all variables

    Select the "propagate" variable ,By default it's value is "True".Set it to False

    Incase any query let me know

    Thanks and Regards

    Rashmi

  • Hi Rashmi,

    That worked for the child package. But, for the parent package, it still shows the same behaviour.

    Thank you for your inputs. It helped.

  • Hi Praveena

    I think this solution will also work for your ParentPackage.Can you please explain in detail what problem you are facing with your Parent Package.

    It will be good if u can send a sample project ,so that I can have a look into it.

    Regards

    Rashmi

  • Hi Rashmi,

    It was logiing twice for the parent package because it actually had 2 errors with in the same task.

    Error 1: Cannot open the datafile "S:\DB\xfer\Process\0000_ow_master_12042010_100005.unl1".

    Error 2: component "Flat File Source" (1) failed the pre-execute phase and returned error code 0xC020200E.

    Thank you for all the info.

    Praveena

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply