prisma / quaint

SQL Query AST and Visitor for Rust
Apache License 2.0
582 stars 61 forks source link

feat(postgres): map 'std::io::ErrorKind::InvalidInput' coming from 'tokio_postgres' to 'quaint::error::ErrorKind::QueryInvalidInput' #400

Closed jkomyno closed 1 year ago

jkomyno commented 1 year ago

Context: https://www.notion.so/prismaio/Postgres-parameters-length-validation-ffc127b887984e02b9d931fcec4d6d15#62014932a75e438e9eb07306aee43224

Allows fixes to https://prisma/prisma/issues/8832 and https://prisma/prisma/issues/9326.

jkomyno commented 1 year ago

A good start. Are you planning to catch this in engines? What is the plan forward?

Thank you. The next step is reviewing and merging https://github.com/prisma/prisma-engines/pull/3201. It catches all quaint::error::ErrorKind::QueryInvalidInput and presents them as user-facing DatabaseAssertionViolation errors, which would forward the tokio-driver errors to the user (in the future, other assertion violation checks resulting in errors in other drivers can be mapped to this new user-facing error).

Here's an example of how the error would look like on the TS client side.

As you can see, it adds two new tests that currently succeed when run independently, but conflict on the CI (as stated here). We also mentioned the problem in this internal thread.