-
-
Notifications
You must be signed in to change notification settings - Fork 149
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(dev): better DI error messages for instantiation #1917
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1917 +/- ##
==========================================
+ Coverage 88.47% 88.52% +0.04%
==========================================
Files 260 260
Lines 22843 22843
Branches 5258 5258
==========================================
+ Hits 20211 20222 +11
+ Misses 2632 2621 -11 ☔ View full report in Codecov by Sentry. |
646b86b
to
409ca43
Compare
409ca43
to
0120642
Compare
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.
Thanks @bigopon for this nice change! I think most of the devs won't use the dev/builds by default. Hence, I think we should have the same information also for non-dev builds.
@Sayan751 if a serious app was to be public, it needs to be first developed in dev mode before a prod build, and thus, error like this will be prominent and get ridden of, so this scenario we don't need these errors in prod mode. |
In that case, I think we should have "recipe" documentation on how to enable the dev mode. As it might not always be straightforward. |
@Sayan751 thanks, and agree, Ive been thinking of an faq doc or something to describe these. |
2.0.0-beta.13 (2024-03-15) **BREAKING CHANGE:** * **event:** no longer call prevent default by default (#1926) ([f71e9e7](f71e9e7)) * **exports:** no longer re-export fetch client package (#1926) ([f71e9e7](f71e9e7)) **Features:** * **process-content:** ability to add template information to a data object (#1925) ([2a4c436](2a4c436)) * **template-controller:** ability to have a container per factory (#1924) ([6727b56](6727b56)) * **convention:** add import as support (#1920) ([7a15551](7a15551)) * **resources:** api to register resources with alias key ([7a15551](7a15551)) * **dev:** better DI error messages for instantiation (#1917) ([2fca6ea](2fca6ea)) **Bug Fixes:** * **router-lite:** dont register config ([f71e9e7](f71e9e7)) * **di:** cache factory on singleton resolution ([dc22fb7](dc22fb7)) **Refactorings:** * **router:** (DEV) dont swallow instantiation error details ([deee8e6](deee8e6)) * **compiler:** remove special treatment for au slot ([2a4c436](2a4c436)) * **kernel:** smaller di files, assert text options, more au slot tests ([deee8e6](deee8e6)) * **runtime:** move constructor registration into controller ([7a15551](7a15551)) * **resource:** cleanup registration, APIs (#1918) ([dc22fb7](dc22fb7)) * **resources:** cleanup util fn, move to kernel package ([dc22fb7](dc22fb7)) * **resources:** move find to corresponding resource kind ([dc22fb7](dc22fb7)) * **di:** add registrable, remove unecessary infra for attr pattern ([dc22fb7](dc22fb7)) * **resource:** remove resource protocol, simplify resource metadata ([dc22fb7](dc22fb7)) **Docs:** * **docs:** add key documentation for the repeater (#1921) ([c3d0ed3](c3d0ed3)) * **docs:** add documentation for event preventDefault breaking change (#1926) ([f71e9e7](f71e9e7))
@tareqimbasher Here is an example how to use development builds: https://github.com/aurelia/new/blob/master/webpack/webpack.config.js#L120 |
@Sayan751 Great, thank you! Plugged in those aliases and its working. |
📖 Description
Currently, when there is an error during the instantiation of a class, there is not enough information what went wrong. This is quite an issue once there are multiple changes being added in at once, like in a dependency upgrade.
Enhance the DEV mode error message by catching the dependency resolution error while instantiate, so that there will be more information for debugging.
Examples
for the following code with
inject
:The error messages logged will look like this:
For the following code with
resolve
:The error messages logged will look like this
![image](https://private-user-images.githubusercontent.com/9994529/309473304-74ddff59-3c1b-44af-b9fb-09161a3c9b5a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ5ODMwMjYsIm5iZiI6MTcyNDk4MjcyNiwicGF0aCI6Ii85OTk0NTI5LzMwOTQ3MzMwNC03NGRkZmY1OS0zYzFiLTQ0YWYtYjlmYi0wOTE2MWEzYzliNWEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgzMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MzBUMDE1MjA2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWM3NjQ2M2I5NWYzZjc3ZTMwYTU4MmRmYmE0YzNmMjEzODgxZGM4ODk4MjIwYjgxOWE3YWMxMjFmYWIxY2UyYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.Z89CjAOh2od95l8t3NVknq6iSybYt2DSgR5XPucobqM)
🎫 Issues
Resolves #913
cc @xenoterracide @Sayan751 @fkleuver