Repository: prisma/prisma-client-js

Issue #195: Turn off pretty errors
Created: 2019-08-18T22:06:28Z
When creating the generated client, is there a way for it to return regularly formatted errors without the line numbers or coloring? Or are there properties on the error object where I can look for codes or something that doesn't include all the unicode characters? I've been looking around trying to find what might include this information but it isn't very apparent.
On create failure console example:
PhotonError: 
Invalid `photon.users.create()` invocation in /Users/rizowski/git/work/auth/server/graphql/controllers/users.js:7:22

{
  username: 'test',
  ~~~~~~~~
  password: 'secret',
  ~~~~~~~~
  email: 'test@test.com',
  ~~~~~
+ data: {
+   id?: ID,
+   username: String,
+   email: String,
+   password: String,
+   created?: DateTime,
+   updated?: DateTime,
+   role?: EMPLOYEE | TRAINER | CLIENT | PARTNER,
+   resetPassToken: String,
+   resetPassExpiration: DateTime
+ }
}

Unknown arg `username` in username for type User. Did you mean `select`?
Unknown arg `password` in password for type User. Did you mean `data`?
Unknown arg `email` in email for type User. Did you mean `data`?
Argument data for data is missing.

Note: Lines with + are required

    at Document.validate (/Users/rizowski/git/workout/auth/node_modules/@generated/photon/runtime/index.js:1718:23)
    at UserClient.get _document [as _document] (/Users/rizowski/git/workout/auth/node_modules/@generated/photon/index.js:289:22)
    at UserClient.then (/Users/rizowski/git/workout/auth/node_modules/@generated/photon/index.js:310:63)
    at processTicksAndRejections (internal/process/task_queues.js:85:5)

String when serialized:
\nInvalid `photon.users.create()` invocation in /Users/rizowski/git/workout/auth/server/graphql/controllers/users.js:7:22\n\n{\n  username: 'test',\n  ~~~~~~~~\n  password: 'secret',\n  ~~~~~~~~\n  email: 'test@test.com',\n  ~~~~~\n+ data: {\n+   id?: ID,\n+   username: String,\n+   email: String,\n+   password: String,\n+   created?: DateTime,\n+   updated?: DateTime,\n+   role?: EMPLOYEE | TRAINER | CLIENT | PARTNER,\n+   resetPassToken: String,\n+   resetPassExpiration: DateTime\n+ }\n}\n\nUnknown arg `username` in username for type User. Did you mean `select`?\nUnknown arg `password` in password for type User. Did you mean `data`?\nUnknown arg `email` in email for type User. Did you mean `data`?\nArgument data for data is missing.\n\nNote: Lines with + are required\n

Again I don't think these kinds of errors are bad when you are developing but having the ability to make them less verbose would be nice for production environments.
Suggestions:
I personally like having error codes come back on my error objects. It makes it nice for trying to decipher what is wrong programmatically a lot simpler. (As long as they don't change)
The pretty text could be fine if it is attached to the error object but maybe not as the main error message. Ideally it can be turned off or changed to have multiple properties on the error that describe the same information.

Duplicate issue #367: Unreadable error trace message
Created: 2019-12-26T09:27:37Z
I got a "INTERNAL_SERVER_ERROR" and the stacktrace is totally unreadable, it looks something like this:

prisma/photon: 2.0.0-preview018.2
nexus: ^0.12.0-rc.5
nexus-prisma: ^0.6.1

Closing comment (2020-01-06T13:24:07Z): Closing this as a duplicate of #195
It was never implemented, I am adding a candidate label to this so it is (hopefully) picked up by us soon 🙏
This workaround might work for you, if the error throwing logic is in your application or you can modify that in your server library: #195 (comment)