How to capture PowerServer-specific errors such as Transaction Timeout?

Errors such as

are returned when performing certain database operations, so you can capture these errors using the same way as you capture errors for the database operations in the PowerBuilder C/S application.

DataWindow and DataStore errors can be captured and processed in the DB Error event.

For example, in the DataWindow (e.g.: u_dw) -> DBError Event

If sqldbcode = -1 And &
        (Pos(sqlerrtext, "Transaction is timeout") = 1 or Pos(sqlerrtext, "Transaction does not exist") = 1) Then
        
        // You can output your own log or message
        // ...
        
        // You can set the return code to affect the outcome of the event:
        // E.g.: Return 0 to Display the error message and trigger the Transaction object's DBError event if it is defined.
End If

Embedded SQL etc. can be captured in the DB Error event of the Transaction object.

For example, in the Transaction (e.g.: n_tr) -> DBError Event

If code = -1 And &
        (Pos(sqlerrortext, "Transaction is timeout") = 1 or Pos(sqlerrortext, "Transaction does not exist") = 1) Then
        
        // You can output your own log or message
        // ...

End If