Handling Fatal Errors in AJAX Functions

Visual LANSA Framework

Handling Fatal Errors in AJAX Functions

By default fatal errors in your server side AJAX functions are generally trapped and displayed by the Framework.

You can stop this from happening and handle the error display yourself.

When invoking the SENDREQUEST function pass the 7th parameter as false.

 

Eg: SENDREQUEST(window,"","LOAD10","",LOAD10_response,null,false);   

 

 

This tells the Framework not display the fatal error details itself.

 

In all cases your JavaScript request handler is always called with parameters that indicate that a fatal error has occurred and a composite message is made up of all the trapped error messages.

 

function Resp(strFunction,strRequest,strPayload,objObject,flagErrorFatal,strFatalMessage

   

/* Handle a fatal error in the server function */  

 

if (flagFatalError)  

{  

   alert(strFatalMessage);  

   SETBUSY(false);  

   return;  

 

/* Else process the response from the server */ 

 

… etc ……    

     

Note:  The fatal error flag refers to fatal errors in the server side AJAX function, not to fatal errors in your client side JavaScript, which you should trap and handle yourself.