Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Information on Errors #1067

Closed
LazerJesus opened this issue Oct 18, 2023 · 8 comments
Closed

More Information on Errors #1067

LazerJesus opened this issue Oct 18, 2023 · 8 comments

Comments

@LazerJesus
Copy link

Hi,
i am running into errors and find the error message I get quite useless.

error: Cannot find module "@pothos/plugin-errors" from "game/code/spanish2/backend/src/pothos-client/core.js"
1 | /* eslint-disable max-classes-per-file */ export class PothosError extends Error {
2 |     constructor(message) {
3 |         super(message);
            ^
PothosSchemaError: Missing definition for [object Object]
      at new PothosError (game/code/spanish2/backend/node_modules/@pothos/core/esm/errors.js:3:8)
      at new PothosSchemaError (game/code/spanish2/backend/node_modules/@pothos/core/esm/errors.js:9:8)
      at createFieldConfig (game/code/spanish2/backend/node_modules/@pothos/core/esm/config-store.js:94:18)
      at buildField (game/code/spanish2/backend/node_modules/@pothos/core/esm/config-store.js:304:28)
      at game/code/spanish2/backend/node_modules/@pothos/core/esm/config-store.js:298:16
      at forEach (:1:20)
      at buildFields (game/code/spanish2/backend/node_modules/@pothos/core/esm/config-store.js:289:8)
      at game/code/spanish2/backend/node_modules/@pothos/core/esm/config-store.js:262:12
      at onTypeConfig (game/code/spanish2/backend/node_modules/@pothos/core/esm/config-store.js:204:12)
      at game/code/spanish2/backend/node_modules/@pothos/core/esm/config-store.js:261:52
      at game/code/spanish2/backend/node_modules/@pothos/core/esm/config-store.js:246:46
      at forEach (:1:20)
      at prepareForBuild (game/code/spanish2/backend/node_modules/@pothos/core/esm/config-store.js:245:8)
      at buildAll (game/code/spanish2/backend/node_modules/@pothos/core/esm/build-cache.js:56:8)
      at toSchema (game/code/spanish2/backend/node_modules/@pothos/core/esm/builder.js:334:8)
      at game/code/spanish2/backend/src/pothos-client/schema.js:11:22
      at processTicksAndRejections (:55:76)

this doesnt have any information i can use. the schema.js:11 line is builder.toSchema().

is this lack of detail due to my setup and somehow fixable?

@hayes
Copy link
Owner

hayes commented Oct 18, 2023

I think you are passing the wrong thing to the plugin list. Make sure you are using the default export from Pothos/error-plugin sorry misread the error, and thought it was something else I had seen before

@hayes
Copy link
Owner

hayes commented Oct 18, 2023

It looks like this error happens when a fields arguments reference an type that hasn't been implemented. In your case. Refs should generally not be printed as objectObject, so likely what's happening is a field is referencing some other type of object in the type field of it's options.

What I would recommend is updating the error message (you can just edit it in node_modules) to include the ref and name passed in to the function. For the ref you can print it with describeRef the same way the missing ref is printed. The relevant code is here:

`Missing implementation for ${this.describeRef(this.pendingFields.get(ref)!)}`,

This should also be done in Pothos, but just doing it locally might help you track down where in the schema the error is coming from

@hayes
Copy link
Owner

hayes commented Oct 18, 2023

Something like Missing implementation for ${this.describeRef(this.pendingFields.get(ref)!)} Used in field {name} of ${this.describeRef(ref)},

@hayes
Copy link
Owner

hayes commented Oct 18, 2023

Adding parentField is probably also useful. field will be the argument name, and parent field will be the field name you care about... So the message I mentioned above is probably slightly misleading

@LazerJesus
Copy link
Author

any reason why that is not the default?
For me this is not about any one specific error but about the gerneral DevX. I dont want to patch nodemodules manually on each install

@hayes
Copy link
Owner

hayes commented Nov 21, 2023

No, just haven't had time to implement these changes, a PR would be more than welcome!

@hayes
Copy link
Owner

hayes commented Dec 3, 2023

Just pushed a fix with an improved error message

@hayes hayes closed this as completed Dec 3, 2023
@LazerJesus
Copy link
Author

thank you @hayes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants