catch the exception details and log into a log file using scriptella etl

212 views
Skip to first unread message

saurabh chakrabarthi

unread,
Apr 19, 2013, 9:32:45 AM4/19/13
to scrip...@googlegroups.com
Hi All,
          How can we able to catch exception details in <orerror/> tag and log details into a log files? Please help me in this regards.
             Thanks in advance.
 
Regards,
    
 Saurabh

Fyodor Kupolov

unread,
May 8, 2013, 4:42:15 PM5/8/13
to scrip...@googlegroups.com
Hi Saurabh,

This feature is not currently supported. As a workaround you can wrap a script with an additional janino query and catch the exception there. A root cause needs to be unwrapped by walking through the chain of exceptions causing the error:
    <connection id="db" url="jdbc:hsqldb:mem:test"/>
    <connection id="java" driver="janino"/>

    <query connection-id="java">
        try {
            next();
        } catch( Exception e ) {
            System.out.println("Error: "+e);
            System.out.println("Cause: "+e.getCause());
            //May need to walk deeper up to the root cause
            e.printStackTrace();
        }
        <script connection-id="db">
            SYNTAX ERROR
        </script>

    </query>

I plan to add support for switching of connection-id in the <onerror> element and exposing the error details as object, so something like this should become possible:

<script>
   ERROR STATEMENT;
   <onerror connection-id="text">
        Error ${error_details.exception.name}
   </onerror>
</script>
Reply all
Reply to author
Forward
0 new messages