sfackler / rust-postgres

Native PostgreSQL driver for the Rust programming language
Apache License 2.0
3.52k stars 446 forks source link

Make error::Kind public #1185

Open levkk opened 3 weeks ago

levkk commented 3 weeks ago

Make error::Kind public and provide a getter. This allows lib/app code to handle different kind of errors, e.g.

match err.kind() {
    Kind::Column(name) => panic!("You forgot to include column {} into the query", name),
    Kind::Parameter(_, _) => panic!("You forgot to pass a parameter to the prepared statement"),
    kind => panic!("{:?}", kind),
}

I documented errors I know about, but the ones I don't know what they do I left undocumented, hiding the doc warning.