Skip to content

Commit

Permalink
fix(core): Update ngfor error code to be negative (#46555)
Browse files Browse the repository at this point in the history
This adds the fancy link to the error code documentation automatically

PR Close #46555
  • Loading branch information
jessicajaniuk authored and dylhunn committed Jun 28, 2022
1 parent d6fac9e commit 8bde2db
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion goldens/public-api/common/errors.md
Expand Up @@ -9,7 +9,7 @@ export const enum RuntimeErrorCode {
// (undocumented)
INVALID_PIPE_ARGUMENT = 2100,
// (undocumented)
NG_FOR_MISSING_DIFFER = 2200,
NG_FOR_MISSING_DIFFER = -2200,
// (undocumented)
PARENT_NG_SWITCH_NOT_FOUND = 2000
}
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/errors.ts
Expand Up @@ -16,5 +16,5 @@ export const enum RuntimeErrorCode {
// Pipe errors
INVALID_PIPE_ARGUMENT = 2100,
// NgForOf errors
NG_FOR_MISSING_DIFFER = 2200,
NG_FOR_MISSING_DIFFER = -2200,
}
4 changes: 2 additions & 2 deletions packages/common/test/directives/ng_for_spec.ts
Expand Up @@ -120,7 +120,7 @@ let thisArg: any;
getComponent().items = <any>'whaaa';
expect(() => fixture.detectChanges())
.toThrowError(
/NG02200: Cannot find a differ supporting object 'whaaa' of type 'string'. NgFor only supports binding to Iterables, such as Arrays./);
`NG02200: Cannot find a differ supporting object 'whaaa' of type 'string'. NgFor only supports binding to Iterables, such as Arrays. Find more at https://angular.io/errors/NG02200`);
}));

it('should throw on non-iterable ref and suggest using an array ', waitForAsync(() => {
Expand All @@ -129,7 +129,7 @@ let thisArg: any;
getComponent().items = <any>{'stuff': 'whaaa'};
expect(() => fixture.detectChanges())
.toThrowError(
/NG02200: Cannot find a differ supporting object '\[object Object\]' of type 'object'. NgFor only supports binding to Iterables, such as Arrays. Did you mean to use the keyvalue pipe?/);
`NG02200: Cannot find a differ supporting object '\[object Object\]' of type 'object'. NgFor only supports binding to Iterables, such as Arrays. Did you mean to use the keyvalue pipe? Find more at https://angular.io/errors/NG02200`);
}));

it('should throw on ref changing to string', waitForAsync(() => {
Expand Down

0 comments on commit 8bde2db

Please sign in to comment.