Saturday, February 25, 2012

Capturing Error Information

Question #1
Is there a way to get a handle on the context of an error within an Error Handler for a task, containter, or package?

ie:
I am looking to log(Custom logging using script task not Log provider) error information, code, stack, etc. from a task or container that fails due to an unhandled exception. When the exception is handled using OnError event handler, I don't get the context of the task or the container.

Question #2
Is there a reason why Pre and post execute events for a package get executed several times? I have a script task that logs pre/post package information into our db, however, everytime I run the package in debug mode, it logs 5 - 10 messages into the DB for pre/post events. Don't these events ONLY fire once per package?

for #1 see
http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=86691

for #2 see
http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=86608|||Thank you for the reply. The #2 is answered, however, for #1, what if I don't have logging configured. In this scenario the exception will be lost and logged to the DB.

Is there a way, I can pick up the context of the error from OnError Event handler? or do I have to look at the Db for an error?|||

N.S. wrote:

Thank you for the reply. The #2 is answered, however, for #1, what if I don't have logging configured. In this scenario the exception will be lost and logged to the DB.

Is there a way, I can pick up the context of the error from OnError Event handler? or do I have to look at the Db for an error?

What exactly do you mean by the "context of the error". The OnError event handler provides the error message and information about the container that raised the error so it s obviously something other than those.

-Jamie|||

By Context of the error, I mean the actual error message and error code for the container that raised OnError event.

Within OnError event handler, if I add a script task, how can I retrieve the actual error message and error code? Are there System variables that I can use within the script to get that information? Thanks.

No comments:

Post a Comment