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

Meaningful error messages #13

Open
andreElrico opened this issue Sep 26, 2019 · 2 comments
Open

Meaningful error messages #13

andreElrico opened this issue Sep 26, 2019 · 2 comments

Comments

@andreElrico
Copy link

andreElrico commented Sep 26, 2019

When ANYTHING goes wrong in the lazy module when "attaching" the module, I get the same error message:

ERROR Error: Uncaught (in promise): Error created and attaching module async.

For example I forgot to provide Service1 that is injected in a component and therefore get the "injector cant resolve ..." error. This error is also reflected as: ERROR Error: Uncaught (in promise): Error created and attaching module async. which makes it hard to debug.

The obvious workaround is to develop the module EGERLY and then lazyload the finished product.

Is there any other solution ?


Workaround im currently using:

  1. comment out bootstrap argument in LAZY_MODULE decorator
  2. add LAZY_MODULE in app.module (root module)
  3. add code somewhere in app.component.html
    <button style="position: absolute;" #b1 value="1" (click)="b1.value = b1.value == 1 ? 0 : 1;">RELOADER BTN</button>
    <div *ngIf="b1.value == 1" style="position: absolute; background-color: #FFCCDA; top: 7em; right: 0; left: 0; bottom: 0;">
            
        <app-MyBootstrapComponent></app-MyBootstrapComponent>
    </div>
  1. Develop till perfect.
  2. Revert step 1 + 2,
  3. Comment out code of 3. You might need it for the next lazyModule.
@andreElrico
Copy link
Author

@aaronfrost

please throw the error in the catch

catch (e) {
    rej('Error created and attaching module async.');
    throw e
}

probably also here:

and here

otherwise we only get 'ERROR Error: Uncaught (in promise): Error created and attaching module async.' as error message which is not helpful for debugging.

@andreElrico
Copy link
Author

Current Workaround:

  1. search for "Error created and attaching module async." in Dev-Tools
  2. add a debugger-break point before rej
  3. produce the error again
  4. type the error-argument into console to get a clue what caused the error.

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

1 participant