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

feat(core): add source to StaticInjectorError message #20817

Closed
wants to merge 1 commit into from

Conversation

ocombe
Copy link
Contributor

@ocombe ocombe commented Dec 6, 2017

PR Type

What kind of change does this PR introduce?

[x] Feature

What is the current behavior?

We need more info on StaticInjectorError to help with debugging

Issue Number: #19302, also Fixes #20172

What is the new behavior?

We add the source component (or module) that tried to inject the missing provider, and we also add the source from the injector which triggered the error

Notes:

  • I couldn't get the name of the module containing the component with the failing injector, only the name of the main module (that created the injector).
  • I added a property on tokens named __source, we could use a different property name (I wasn't inspired), but I'm not sure if it's ok to add a property name like that.
  • I'm not sure if adding "Platform: core" for the root injector is really useful, I could remove it

Does this PR introduce a breaking change?

[x] No

Other information

I already did a PR with that change but we had to revert because of issues in g3, but I don't know what were the issues, and I haven't changed the code since then.

@ocombe ocombe added area: core Issues related to the framework runtime action: review The PR is still awaiting reviews from at least one requested reviewer target: major This PR is targeted for the next major release feature Issue that requests a new feature labels Dec 6, 2017
@ocombe ocombe requested a review from mhevery December 6, 2017 09:16
@mary-poppins
Copy link

You can preview 2b12e7f at https://pr20817-2b12e7f.ngbuilds.io/.

@mhevery mhevery added the action: merge The PR is ready for merge by the caretaker label Dec 6, 2017
@jasonaden
Copy link
Contributor

Was rolled back in g3. Determine cause before merging.

@mhevery mhevery removed the action: merge The PR is ready for merge by the caretaker label Dec 6, 2017
@@ -25,7 +25,7 @@ export function moduleProvideDef(
// lowered the expression and then stopped evaluating it,
// i.e. also didn't unwrap it.
value = resolveForwardRef(value);
const depDefs = splitDepsDsl(deps);
Copy link
Contributor

@mhevery mhevery Dec 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that token can be null

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use stringify from core/src/util here as stringify(token)

@@ -83,7 +83,7 @@ export function _def(
// i.e. also didn't unwrap it.
value = resolveForwardRef(value);

const depDefs = splitDepsDsl(deps);
const depDefs = splitDepsDsl(deps, token.name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe same problem here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stringify(token)

@ocombe ocombe force-pushed the feat/static-injector branch from 2b12e7f to 032789a Compare December 11, 2017 15:02
@mary-poppins
Copy link

You can preview 032789a at https://pr20817-032789a.ngbuilds.io/.

@mhevery mhevery added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 12, 2017
@jasonaden jasonaden closed this in b7738e1 Dec 13, 2017
@ocombe ocombe deleted the feat/static-injector branch January 19, 2018 09:39
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime cla: yes feature Issue that requests a new feature target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(core): add source to StaticInjectorError message (#19482)
5 participants