refactor: make RuntimeError class reusable across packages#44398
refactor: make RuntimeError class reusable across packages#44398AndrewKushnir wants to merge 3 commits intoangular:masterfrom
Conversation
a975111 to
95ba577
Compare
|
Hi @twerske, this PR updates the Just wanted to check with you if this use of the error code bit is aligned with the idea that was implemented initially. Thank you. |
|
@alxhub @dylhunn @jessicajaniuk thanks for your review in the previous version of this PR (#44348). I've created a new one with a slightly different approach. Instead of creating a new class for each package (as it was in #44348), this PR reuses the same class and each package contains a thin wrapper that supplies the package id. The motivation for this is to maintain easy error handling ( Could you please review this PR when you get a chance? |
jessicajaniuk
left a comment
There was a problem hiding this comment.
LGTM 🍪
reviewed-for: size-tracking, fw-core, fw-common
dylhunn
left a comment
There was a problem hiding this comment.
reviewed-for: size-tracking, fw-core, fw-common, fw-forms
|
Thanks for tagging me @AndrewKushnir! One design concern is that For example In the initial design for runtime errors (internal design can be found here) one of the constraints was that Is there a way to add or use the categories in the second digit per package? Love the addition of additional error codes in a more standard format and if there's space to add docs as well that'd be AMAZING! |
bd7acbe to
0aa574a
Compare
|
Thanks for the review everyone! @twerske thanks for your feedback, that makes sense. I've reworked the changes a bit to retain the
The benefit is that we'll use the bit next to |
This commit updates the code around the `RuntimeError` class to make it more reusable between packages (currently it's only usable inside the `core` package). Specifically: - the error formatting logic was updated to handle cases when there is no error message provided - there is no special Set that contains a set of error codes for which we have guides on angular.io. Instead, this is now encoded into the error code itself (making such codes negative integers). Having a separate Set makes it non-tree-shakable, which we want to avoid. This change should allow to employ the `RuntimeError` class in other packages to further standardize this subsystem and make the errors thrown by the framework consistent. As a part of the refactoring, the `common` package code was also updated to follow the same logic as `core`, since the `RuntimeError` class was used there as well.
This commit moves some logic to make the location of runtime error codes consistent across packages. Now all error codes are located in `packages/core/src/errors.ts` file.
Agreed, I will followup with a new PR once this one lands. |
|
Note to the Caretaker: this PR would require a local mod update in g3, please ping me for additional info. |
|
This PR was merged into the repository by commit 67df935. |
This commit moves some logic to make the location of runtime error codes consistent across packages. Now all error codes are located in `packages/core/src/errors.ts` file. PR Close #44398
This commit performs some refactoring of the AbstractControl-based classes to employ shared `RuntimeError` class and also updates the code to avoid duplication and improve minification. PR Close #44398
…4398) This commit updates the code around the `RuntimeError` class to make it more reusable between packages (currently it's only usable inside the `core` package). Specifically: - the error formatting logic was updated to handle cases when there is no error message provided - there is no special Set that contains a set of error codes for which we have guides on angular.io. Instead, this is now encoded into the error code itself (making such codes negative integers). Having a separate Set makes it non-tree-shakable, which we want to avoid. This change should allow to employ the `RuntimeError` class in other packages to further standardize this subsystem and make the errors thrown by the framework consistent. As a part of the refactoring, the `common` package code was also updated to follow the same logic as `core`, since the `RuntimeError` class was used there as well. PR Close angular#44398
This commit moves some logic to make the location of runtime error codes consistent across packages. Now all error codes are located in `packages/core/src/errors.ts` file. PR Close angular#44398
This commit performs some refactoring of the AbstractControl-based classes to employ shared `RuntimeError` class and also updates the code to avoid duplication and improve minification. PR Close angular#44398
…44652) This commit updates the code around the `RuntimeError` class to make it more reusable between packages (currently it's only usable inside the `core` package). Specifically: - the error formatting logic was updated to handle cases when there is no error message provided - there is no special Set that contains a set of error codes for which we have guides on angular.io. Instead, this is now encoded into the error code itself (making such codes negative integers). Having a separate Set makes it non-tree-shakable, which we want to avoid. This change should allow to employ the `RuntimeError` class in other packages to further standardize this subsystem and make the errors thrown by the framework consistent. As a part of the refactoring, the `common` package code was also updated to follow the same logic as `core`, since the `RuntimeError` class was used there as well. PR Close #44398 PR Close #44652
Runtime error codes in the Core, Common and Forms packages were not included into the `public-api` group reviews. This commit creates the necessary golden files to keep track of further changes in the runtime codes. This is a followup from angular#44398 (comment).
Runtime error codes in the Core, Common and Forms packages were not included into the `public-api` group reviews. This commit creates the necessary golden files to keep track of further changes in the runtime codes. This is a followup from #44398 (comment). PR Close #44677
Runtime error codes in the Core, Common and Forms packages were not included into the `public-api` group reviews. This commit creates the necessary golden files to keep track of further changes in the runtime codes. This is a followup from #44398 (comment). PR Close #44677
Runtime error codes in the Core, Common and Forms packages were not included into the `public-api` group reviews. This commit creates the necessary golden files to keep track of further changes in the runtime codes. This is a followup from angular#44398 (comment). PR Close angular#44677
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This PR contains a few commits that make the
RuntimeErrorclass reusable across packages + performs some refactoring to use the class in the Forms package.Note: this is a replacement PR for #44348.
PR Type
What kind of change does this PR introduce?
Does this PR introduce a breaking change?