Script Component as source using try catch block to log errors to flat file

  • Hi, 
    I am using script component in Data Flow as source and i wanted to wrap up my code with try and catch blocks . The language i am using is C#.Net. In the event of of exception i want to log the exception to the flat file in the catch block with some user variables info.
    I keep getting the error message when using the Dts variables and i have tried the below code and that too is not working.
    can some one help me in providing examples for try catch blocks in Script component .
    Code:
    catch(Exception ex)
      {
      bool pbCancel = false;
      ComponentMetaData.FireError(0, filename, "An error occurred: " + ex.Message.ToString(), "", 0, out pbCancel);  
      }

  • You'll have to provide more info to help the folks here help you. What error message are you getting? What parameters and/or SSIS variables are you passing in and how? What does the rest of your script task look like? Is "ComponentMetaData.FireError" a custom function?

Viewing 2 posts - 1 through 1 (of 1 total)

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