-
Notifications
You must be signed in to change notification settings - Fork 185
Description
Feature Request
Is your feature request related to a problem? Please describe
When the connection is closed unexpectedly it throws a PostgresConnectionClosedException
. I would like to handle this scenario programmatically, however, it currently isn't possible to catch PostgresConnectionClosedException
because it's package-private.
r2dbc-postgresql/src/main/java/io/r2dbc/postgresql/client/ReactorNettyClient.java
Lines 554 to 564 in a32a679
static class PostgresConnectionClosedException extends R2dbcNonTransientResourceException { | |
public PostgresConnectionClosedException(String reason) { | |
super(reason); | |
} | |
public PostgresConnectionClosedException(String reason, @Nullable Throwable cause) { | |
super(reason, cause); | |
} | |
} |
For example, if I'm listening to notifications and want to restart the connection or channel.
Describe the solution you'd like
I would like for PostgresConnectionClosedException
to be public so it can be explicitly caught.
Describe alternatives you've considered
Presently the only alternative I'm aware of is catching R2dbcNonTransientResourceException
and checking for the "UNEXPECTED" error message. This isn't ideal because it's not as clear as catching the specific exception, and the message could change in the future.