Skip to content

Commit 966916b

Browse files
committed
chore: remove newly-added errors
1 parent ad02846 commit 966916b

File tree

7 files changed

+18
-72
lines changed

7 files changed

+18
-72
lines changed

src/lib/core/core.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ export {MdLineModule, MdLine, MdLineSetter} from './line/line';
7676
// Style
7777
export * from './style/index';
7878

79-
// Error
80-
export {MdError} from './errors/error';
81-
8279
// Misc
8380
export {ComponentType} from './overlay/generic-component-type';
8481

src/lib/core/errors/error.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/lib/datepicker/datepicker.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {OverlayRef} from '../core/overlay/overlay-ref';
1717
import {ComponentPortal} from '../core/portal/portal';
1818
import {OverlayState} from '../core/overlay/overlay-state';
1919
import {Dir} from '../core/rtl/dir';
20-
import {MdError} from '../core/errors/error';
2120
import {MdDialog} from '../dialog/dialog';
2221
import {MdDialogRef} from '../dialog/dialog-ref';
2322
import {PositionStrategy} from '../core/overlay/position/position-strategy';
@@ -192,7 +191,7 @@ export class MdDatepicker<D> implements OnDestroy {
192191
*/
193192
_registerInput(input: MdDatepickerInput<D>): void {
194193
if (this._datepickerInput) {
195-
throw new MdError('An MdDatepicker can only be associated with a single input.');
194+
throw new Error('An MdDatepicker can only be associated with a single input.');
196195
}
197196
this._datepickerInput = input;
198197
this._inputSubscription =
@@ -205,7 +204,7 @@ export class MdDatepicker<D> implements OnDestroy {
205204
return;
206205
}
207206
if (!this._datepickerInput) {
208-
throw new MdError('Attempted to open an MdDatepicker with no associated input.');
207+
throw new Error('Attempted to open an MdDatepicker with no associated input.');
209208
}
210209

211210
this.touchUi ? this._openAsDialog() : this._openAsPopup();

src/lib/icon/icon-errors.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/lib/icon/icon-registry.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ import {Injectable, SecurityContext, Optional, SkipSelf} from '@angular/core';
22
import {SafeResourceUrl, DomSanitizer} from '@angular/platform-browser';
33
import {Http} from '@angular/http';
44
import {Observable} from 'rxjs/Observable';
5-
import {
6-
MdIconNameNotFoundError,
7-
MdIconSvgTagNotFoundError,
8-
MdIconNoHttpProviderError,
9-
} from './icon-errors';
105
import 'rxjs/add/observable/forkJoin';
116
import 'rxjs/add/observable/of';
127
import 'rxjs/add/operator/map';
@@ -28,6 +23,16 @@ export function getMdIconNameNotFoundError(iconName: string): Error {
2823
}
2924

3025

26+
/**
27+
* Returns an exception to be thrown when the consumer attempts to use
28+
* `<md-icon>` without including @angular/http.
29+
* @docs-private
30+
*/
31+
export function getMdIconNoHttpProviderError(): Error {
32+
return new Error('Could not find Http provider for use with Angular Material icons. ' +
33+
'Please include the HttpModule from @angular/http in your app imports.');
34+
}
35+
3136
/**
3237
* Configuration for an icon, including the URL and possibly the cached SVG element.
3338
* @docs-private
@@ -377,7 +382,7 @@ export class MdIconRegistry {
377382
*/
378383
private _fetchUrl(safeUrl: SafeResourceUrl): Observable<string> {
379384
if (!this._http) {
380-
throw new MdIconNoHttpProviderError();
385+
throw getMdIconNoHttpProviderError();
381386
}
382387

383388
const url = this._sanitizer.sanitize(SecurityContext.RESOURCE_URL, safeUrl);

src/lib/icon/icon.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import {HttpModule, XHRBackend} from '@angular/http';
44
import {MockBackend} from '@angular/http/testing';
55
import {Component} from '@angular/core';
66
import {MdIconModule} from './index';
7-
import {MdIconRegistry} from './icon-registry';
8-
import {MdIconNoHttpProviderError} from './icon-errors';
7+
import {MdIconRegistry, getMdIconNoHttpProviderError} from './icon-registry';
98
import {getFakeSvgHttpResponse} from './fake-svgs';
9+
import {wrappedErrorMessage} from '../core/testing/wrapped-error-message';
1010

1111

1212
/** Returns the CSS classes assigned to an element as a sorted array. */
@@ -414,14 +414,16 @@ describe('MdIcon without HttpModule', () => {
414414
}));
415415

416416
it('should throw an error when trying to load a remote icon', async() => {
417+
const expectedError = wrappedErrorMessage(getMdIconNoHttpProviderError());
418+
417419
expect(() => {
418420
mdIconRegistry.addSvgIcon('fido', sanitizer.bypassSecurityTrustResourceUrl('dog.svg'));
419421

420422
let fixture = TestBed.createComponent(MdIconFromSvgNameTestApp);
421423

422424
fixture.componentInstance.iconName = 'fido';
423425
fixture.detectChanges();
424-
}).toThrowError(MdIconNoHttpProviderError);
426+
}).toThrowError(expectedError);
425427
});
426428
});
427429

src/lib/icon/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@ export class MdIconModule {}
1414

1515

1616
export * from './icon';
17-
export * from './icon-errors';
1817
export * from './icon-registry';

0 commit comments

Comments
 (0)