Skip to content

Please export your error types (those that can surface to our code) so we can type-check them if so desired #1773

Closed
@metaleap

Description

At least connectError in https://github.com/jackc/pgx/blob/master/pgconn/errors.go — right now, all I can do to prevent users seeing some failed to connect to 'host=%s user=%s database=%s': %s (eg. on overload such as I like to provoke in my test environments) or similar is to give a bland "database problem" or "internal error" on un-matchable (eg. via the very handy SafeToRetry / Timeout helpers) errors .

In this example, if I could without string-pattern-matching detect the ConnectError (vs. others that might also arise from my random current QueryContext/ExecContext call), it could be phrased "briefly down for maintenance" or "it's too popular, we'll be scaling up shortly" etc (since the error can well mean pg's "sorry, too many clients already" rather than true host unreachability). But not if unclear if it's that kind of error.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions