AFAICT the only way for a component to trigger the OnSubjobError and/or OnComponentError flows is to throw an otherwise-uncaught exception, perhaps after executing your own error reporting. However is there any way to stop Talend outputting the Exception and stack trace onto the stdout?
What does your expected result look like? Could you please give us more information about your custom component?
What we can do is to make sure that Talend will be your best choice!