How to handle server errors/exceptions in GWT 2.5 + RequestFactory and PostgreSQL? -


environment

  • gwt 2.5 using requestfactory
  • eclipselink 2.4.1
  • postgresql 9.1

problem

to give context part of requestfactory i'm looking at, i've inserted structure of snippet below:

     requestcontext.persist().fire(new receiver<objectproxy>(){              @override              public void onsuccess(objectproxy response){                     //run code here...              }               @override              public void onfailure(serverfailure error){                    //see description below needs done here.              } 

in onfailure() function, i'd have different responses errors may thrown postgresql such violation of uniqueness constraint when user tries insert new barcode or new id number has been taken (the user must able choose id).

this not have in onfailure() function - looking place in framework handling.

questions

  • how identify , respond different error types thrown database or server in gwt requestfactory?

step 1 - devguidevalidation

you should take @ gwt validation support , example here https://developers.google.com/web-toolkit/doc/latest/devguidevalidation

validation groups can used specify constraints run on client , run on server.

the above feature based on java' jsr-303 bean validation.

step 2 - devguidelogging

combine valiation feature simple remote logging feature of gwt , have efficient clean way of handling exceptions - https://developers.google.com/web-toolkit/doc/latest/devguidelogging


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -