Announcement

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

    Handling unexpected errors on the server side

    I am using SmartClinet Pro. I noticed that any unhandled errors (e.g. null pointer exception) are thrown back to the client as part of response and sometimes the full stack trace. I want to change this default behavior. I want to catch all the exceptions on the server and send only some generic message. Basically want to avoid sending stack traces.

    What would be the best way to do this?

    Thanks for your help.

    #2
    I thought of extending IDACall servlet and override handleDSRequest and catch all the unexpected exception from the application.

    Code:
    @Override
        public DSResponse handleDSRequest(final DSRequest dsRequest, final RPCManager rpc,
                final RequestContext context)
        {
            DSResponse dsResponse;
            try
            {
                dsResponse = dsRequest.execute();
            }
            catch(Exception e)
            {
                LOG.error("Unhandled Exception:", e);
                dsResponse = new DSResponse(DSResponse.STATUS_FAILURE);
                fillRspForUnexpectedError(dsResponse);
            }
            return dsResponse;
        }
    With this approach, I will only be able to take care of avoiding any application errors to go to the client side. But what about smartclient errors which can occur because of wrong configurations or role based authorization.

    Knowing smartclient, I believe there will a better way to handle any exception before the response go out of the server. Like a configuration which can redirect to a configured error page etc

    I will appreciate any help to solve this in the best possible manner.

    Comment


      #3
      Hello, Is there any update on this? Our security scans do not like these errors and report high risk vulnerabilities for these errors. I will appreciate if you can provide a solution to this.

      Comment

      Working...
      X