Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the ComponentMetaData.FireError method do in an SSIS script component

I have gone through MSDN.But could not understand properly about the method mentioned below.

What does the below code do if it is included in an SSIS script destination component?

bool Error = false;
this.ComponentMetaData.FireError(0, "myScriptComponent", 
    "`A Transformation error occurred. Check the corresponding Text File ", 
    "", 0, out Error);`
like image 379
user1254579 Avatar asked Oct 08 '22 03:10

user1254579


1 Answers

The FireError method allows you to raise an error that is consistent with the built in error handling methods used elsewhere in SSIS. I.e. the above code raises an error that is picked up by the OnError event.

The parameters that follow the FireError method are described on BOL.

This can be used to provide adequate error handling (which you always should do when writing any custom code). E.g.:

Try

   'Your Code Here

Catch

   'Error handling here
   Me.ComponentMetadata.FireError(...)

end try

In addition to .FireError, the additional .Fire... methods allow you to fire similar events that will be picked up by SSIS, e.g. .FireInformation allows you to write messages to the output window.

like image 187
Aphillippe Avatar answered Oct 13 '22 10:10

Aphillippe