prisma-engines icon indicating copy to clipboard operation
prisma-engines copied to clipboard

Extra error details for query engine errors

Open garrensmith opened this issue 2 years ago • 0 comments

Adds a list of errors to the query engine dmmf. Adds a new key in the json response for errors that contains more error details. For example:

    {
        "name": "UniqueKeyViolation",
        "code": "P2002",
        "fields": {
            "constraint": {
                "fields": ["email", "name"]
            }
        }
    }

Ticket for this https://github.com/prisma/prisma/issues/5040

A few things to note:

  • I've split up the user-facing-error-macro into user-facing-error-macro and user-facing-error-parsing. I did this because you cannot export functions from a proc-macro crate. And I want to reuse the functions that create the UserError.
  • There is a build.rs file in the user-facing-errrors, it uses the user-facing-error-parsing library to read through all the error files and generate a list of errors that are added to the dmmf.

garrensmith avatar Nov 29 '21 13:11 garrensmith