How to capture HTTP Errors that occasionally occur while the application is running

Occasionally, due to network bottlenecks or other network instabilities, the HTTP request sent by the installable cloud app to the PowerServer Web APIs may not be completed normally.

These errors can also occur when performing certain database operations. Fortunately, you can capture them in the same way as capturing errors in the native PB database operations.

If the HTTP request fails to complete normally, it will return an error code, such as 999, 4xx (client error), or 5xx (server error), which can be used to identify the error.

You can capture and process DataWindow and DataStore errors in the DB Error event effectively.

Take the following error as an example: "HTTP Error! Failed to retrieve the response status".


DataWindow (e.g.: u_dw) -> DBError Event

If sqldbcode = 999  Then
        
        // You can output your own log or message
        // ...
        
End If

You can also capture embedded SQL errors in the DB Error event of the Transaction object.

Transaction (e.g.: n_tr) -> DBError Event

If code = 999 Then
        
        // You can output your own log or message
        // ...

End If