Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/lib/icon/icon-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {DOCUMENT} from '@angular/common';
import {HttpClient} from '@angular/common/http';
import {HttpClient, HttpErrorResponse} from '@angular/common/http';
import {
Inject,
Injectable,
Expand Down Expand Up @@ -353,12 +353,12 @@ export class MatIconRegistry {
.filter(iconSetConfig => !iconSetConfig.svgElement)
.map(iconSetConfig => {
return this._loadSvgIconSetFromConfig(iconSetConfig).pipe(
catchError((err: any): Observable<SVGElement | null> => {
let url = this._sanitizer.sanitize(SecurityContext.RESOURCE_URL, iconSetConfig.url);
catchError((err: HttpErrorResponse): Observable<SVGElement | null> => {
const url = this._sanitizer.sanitize(SecurityContext.RESOURCE_URL, iconSetConfig.url);

// Swallow errors fetching individual URLs so the combined Observable won't
// necessarily fail.
console.log(`Loading icon set URL: ${url} failed: ${err}`);
// Swallow errors fetching individual URLs so the
// combined Observable won't necessarily fail.
console.error(`Loading icon set URL: ${url} failed: ${err.message}`);
return observableOf(null);
})
);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/icon/icon.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,9 @@ describe('MatIcon', () => {
}));

it('should throw an error when using untrusted HTML', () => {
// Stub out console.warn so we don't pollute our logs with Angular's warnings.
// Stub out console.error so we don't pollute our logs with Angular's warnings.
// Jasmine will tear the spy down at the end of the test.
spyOn(console, 'warn');
spyOn(console, 'error');

expect(() => {
iconRegistry.addSvgIconLiteral('circle', '<svg><circle></svg>');
Expand Down