Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Exceptions and logging

    Hi,

    1) TransactionNum
    I'm overriding this method in my own IDACall
    Code:
    @Override
    public DSResponse handleDSRequest(DSRequest dsRequest, RPCManager rpc, RequestContext context)
    and want to log the transactionNum, but it's null (see screenshot in Eclipse debugger).

    I can get the number via
    Code:
    RPCManager.getTransactionNum(dsRequest.context.request)
    Is that the normal way?



    2) Exception lost
    When I call super.handleDSRequest(dsRequest, rpc, context), everything boils down OK, till a point where I throw a RuntimeException (that's OK, I want it).
    However, that call catches the exception and puts it in the DSResponse as data.

    I see the exception and stacktrace logged in the SmartClient server log file:
    Code:
    [l0-5] WARN  RequestContext - dsRequest.execute() failed: ....
    But I'd like to catch it myself (/as well). Is there some override point I can use to pass some more information about the exception to the DSResponse object?


    some more info:
    This is the stacktrace logged above found in the SmartClient server log file. ZzzIDACall.java:79 is the place where I expected to catch that error.
    Code:
    zzz.server.util.error.ZzzRuntimeException: not found.
    	at zzz.server.util.general.ZzzSessionUtil.postSessionInvoke(ZzzSessionUtil.java:33)
    	at zzz.server.stores.ZzzAncestorSessStore.postInvoke(ZzzAncestorSessStore.java:268)
    	at zzz.server.stores.menu.MNodeSessStore.getM(MNodeSessStore.java:44)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:883)
    	at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:575)
    	at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64)
    	at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1413)
    	at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:173)
    	at zzz.server.custom.ZzzIDACall.handleDSRequest(ZzzIDACall.java:79)
    	at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:130)
    	at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:95)
    	at com.isomorphic.servlet.IDACall.doPost(IDACall.java:54)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    	at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
    	at zzz.server.custom.ZzzIDACall.service(ZzzIDACall.java:60)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

    thanks
    SmartClient Version: SC_SNAPSHOT-2010-10-27
    Attached Files

    #2
    1) there's not currently an official API to get it, but you'll notice it is passed as an HTTP parameter as well

    2) not clear on what you want - it seems like your options are the usual ones: either catch the exception yourself, or to throw it through and accept how it's handled.

    Comment


      #3
      1) Well, there is API for it: RPCManager rpc.getTransactionNum(), but it returns null.

      2) Somewhere dsRequest.execute() seems to catch the exception and puts the message in the dsResponse data.
      Can I somehow override this behavior (and put the stacktrace etc also in the dsResponse) ?

      Comment


        #4
        1) there's no official (meaning: documented and supported) API

        2) if you don't want the default handling, catch the exception with logic in a DMI rather than allowing it to be thrown through

        Comment

        Working...
        X