isViolation function

bool isViolation(
  1. dynamic ex,
  2. String code
)

Whether it is PostgresqlException about the violation of the given code.

Implementation

bool isViolation(ex, String code)
=> ex is PostgresqlException && ex.serverMessage?.code == code;