Choose whichever of the sets of code you want to use and build it into a DLL. This
article[
^] will show you how.
This
blog article[
^] details what to do next to be able to call it from the SSIS package.
Personally, I think this is entirely the wrong way to address the problem.
Find what is causing the error and fix it
OR
Use Try-Catch to
handle the error[
^] in a meaningful way