One Star

How to implement OnComponentError?

I find that many components (for example tXSLT) do not support OnComponentError, even though they allow you to use the flow.
It's also not clear how to implement such a feature when creating components.  At the moment I'm using the following code snippet to implement the functionality within a custom component:
        <% if (("true").equals(useErrorWorkflow)) {%>
            // A horrible hack to support OnComponentError workflows
            <%=cid%>_error(e, "<%=cid%>", globalMap);
        <% } %>

I assume there must be a better way to implement this as it is using a 'hidden' function to implement the flow.
Could somebody point me in the right direction for how to implement the support for OnComponentError within my components?
2 REPLIES
Moderator

Re: How to implement OnComponentError?

Hi,
Have you already checked talend KB articles about:TalendHelpCenter:What is a Talend component and TalendHelpCenter:How to create a custom component?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: How to implement OnComponentError?

For anyone coming across this thread:
The OnComponentError workflows are only triggered when the components code throws an error.  If the component catches and ignores errors then it will never be used.  Typically only useful for those components that have a "Die on Error" option.