Skip to content

Associate PostgresConnectionClosedException with error code 08006 #538

@rgmz

Description

@rgmz

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.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions