Generalized GWT Exception Handling

Handling exception is always a challenge in Enterprise application. When the project is big and you have lot of people working in the project, it becomes necessary that you have common mechanism for handling the exception in your project.

In GWT Enterprise Application, You basically need to handle 2 types of exception.

  1. GWT Code Exception
  2. RPC Call Exception

Today we will discuss how to handle GWT Code Exception in a generalized manner. We need to follow the below mentioned steps for the same.

  • Create a class with the naming standards, which you have been following on GWT side code.
  • That class should extend class. Say for example our Class name is CommonExceptionHandler.
  • Now we need to overwrite the below mentioned method in that class


public void onUncaughtException(Throwable caught)


  • In the upper mentioned method, write the code which you would like to get executed when exception comes in your application.
  • Now in order to register this class as a exception handler class, Open the GWT Entry point class of your application.
  • In that Entry point class , go to onModuleLoad() method
  • In onModuleLoad() method , put the below mentioned statement as the first statement.

GWT.setUncaughtExceptionHandler(new CommonExceptionHandler ());

That’s IT. With this in place, Whatever exception comes in you application, will be routed to onUncaughtException() method.

(Visited 11 times, 1 visits today)

Related Posts:

Author - admin_specindia



  • 2018
  • 2017
  • 2016
  • 2015
  • 2014
  • 2013
  • 2012
  • 2011
  • 2010
  • 2009
  • 2008
  • Related Blogs

    Current Openings
    Scroll Up