instanceof postgres.PostgresError not working

How can I check the error is of instance PostgresError ? It seems the condition is not met...

Even though when console logging the error its clearly a postgres error:

[Error [PostgresError]: duplicate key value violates unique constraint "..."] {
...
}

Im using postgres package as driver.
Was this page helpful?