Customized error message for dynamic loading


We are using an authenticated Ajax call for populating a treegrid. If user try to refresh their grid after authentication cookie had expired (1 hour expiration), XML call to the back-end will fail and a pop-up with “Incorrect XML” message would be displayed on the screen. Is there a way to customize this message (preferably on the fly)? Instead of the “Incorrect XML”, we would like display “Your session had been expired. Please try to relogin”.


The “Incorrect XML” message is inner error, which can be catch in next way

    //any custom messages here

The function attached as error handler receive additional params, which can be used to detect problem details ( it possible to get exact text of server side response )