Skip to main content

Posts

Showing posts from June, 2016

Add Custom Error Handler in Vaadin 7.6

I took a small break from ADF for a month and helped a customer build their web app using Vaadin 7.6. They had a very strick requirement on handling "unhandled exception". So I implemented something very similar to what I did for ADF last year :), but in Vaadin style. In a nutshell : 1. Lets catch the unhandled exception. 2. Generate an unique ID for this incident and generate seaparate l og file. 3. Log it with detailed stacktrace and thread dumps and other useful details(username, time etc.) 4. Save it in a specific directory. 5. Redirect the user to an Error page with the incident ID, so that user can report back to the admin people. First of all, we need 2 classes. One singleton which does the creating incident id and logging, another session scoped bean to store the incident id which we will show the user in the Error page. Singleton class : CustomExceptionHandler      private static CustomExceptionHandler instance = null;     protected ...