-
Notifications
You must be signed in to change notification settings - Fork 45
Make missing token error more actionable #322
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think this helps the duplicate token case, but makes the missing token case much harder to debug. The dependentToken
case was very useful to know what tokens depended on this token, so you know where to look for documentation. Anyway we can keep both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, this error message is extremely useful when forgetting to register a token:
Error: Could not resolve token: "ApolloClientEndpointToken", which is required by plugins registered with tokens: "ApolloClientToken". Did you forget to register a value for "ApolloClientEndpointToken"?
@KevinGrandon I incorporated the old message into the new one. It now says |
Codecov Report
@@ Coverage Diff @@
## master #322 +/- ##
=========================================
Coverage ? 93.31%
=========================================
Files ? 18
Lines ? 434
Branches ? 85
=========================================
Hits ? 405
Misses ? 16
Partials ? 13
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this is definitely starting to get better. I would love some kind of tree-view of all registered tokens...
Yeah, I'm thinking what's the best way to expose that tree. I'm going to merge this for now, and look into a DI graph viz separately |
TL;DR: People have been running into an issue where having multiple versions of a same plugin would cause the DI system to throw errors about missing dependencies. The error was cryptic and difficult to troubleshoot.
This PR exposes stack information about the missing token as well as potential problematic duplicated tokens, and it offers actionable suggestions to fix the issue.
I labeled this PR w/ the feature flag because this diff adds a
stack
field toToken