fix(core): log error instead of warning for unknown properties and elements (#35798)

Changes the Ivy unknown element/property messages from being logged with `console.warn` to `console.error`. This should make them a bit more visible without breaking existing apps. Furthermore, a lot of folks filter out warning messages in the dev tools' console, whereas errors are usually still shown.

Fixes #35699.

PR Close #35798
This commit is contained in:
crisbeto
2020-03-03 17:42:44 +01:00
committed by atscott
parent ed44073a58
commit 00f3c58bb9
7 changed files with 47 additions and 47 deletions

View File

@ -937,7 +937,7 @@ Did you run and wait for 'resolveComponentResources()'?` :
});
modifiedInIvy(`Unknown property error thrown instead of logging a warning`)
modifiedInIvy(`Unknown property error thrown instead of logging a message`)
.it('should error on unknown bound properties on custom elements by default', () => {
@Component({template: '<some-element [someUnknownProp]="true"></some-element>'})
class ComponentUsingInvalidProperty {
@ -956,13 +956,13 @@ Did you run and wait for 'resolveComponentResources()'?` :
restoreJasmineIt();
});
onlyInIvy(`Unknown property warning logged instead of an error`)
onlyInIvy(`Unknown property error logged instead of throwing`)
.it('should error on unknown bound properties on custom elements by default', () => {
@Component({template: '<div [someUnknownProp]="true"></div>'})
class ComponentUsingInvalidProperty {
}
const spy = spyOn(console, 'warn');
const spy = spyOn(console, 'error');
withModule({declarations: [ComponentUsingInvalidProperty]}, () => {
const fixture = TestBed.createComponent(ComponentUsingInvalidProperty);
fixture.detectChanges();