From d0059b5d75759291ee29914e4200ebccf9144cf9 Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Thu, 23 Apr 2015 15:27:20 +0200 Subject: [PATCH] refactor(PipeRegistry): improve error messages Closes #1504 --- .../angular2/src/change_detection/pipes/pipe_registry.js | 6 +++--- .../test/change_detection/pipes/pipe_registry_spec.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/angular2/src/change_detection/pipes/pipe_registry.js b/modules/angular2/src/change_detection/pipes/pipe_registry.js index 1e779afd7f..e64da907f6 100644 --- a/modules/angular2/src/change_detection/pipes/pipe_registry.js +++ b/modules/angular2/src/change_detection/pipes/pipe_registry.js @@ -15,16 +15,16 @@ export class PipeRegistry { get(type:string, obj, cdRef:ChangeDetectorRef):Pipe { var listOfConfigs = this.config[type]; if (isBlank(listOfConfigs)) { - throw new BaseException(`Cannot find a pipe for type '${type}' object '${obj}'`); + throw new BaseException(`Cannot find '${type}' pipe supporting object '${obj}'`); } var matchingConfig = ListWrapper.find(listOfConfigs, (pipeConfig) => pipeConfig.supports(obj)); if (isBlank(matchingConfig)) { - throw new BaseException(`Cannot find a pipe for type '${type}' object '${obj}'`); + throw new BaseException(`Cannot find '${type}' pipe supporting object '${obj}'`); } return matchingConfig.create(cdRef); } -} \ No newline at end of file +} diff --git a/modules/angular2/test/change_detection/pipes/pipe_registry_spec.js b/modules/angular2/test/change_detection/pipes/pipe_registry_spec.js index c345f36043..5afa496f5c 100644 --- a/modules/angular2/test/change_detection/pipes/pipe_registry_spec.js +++ b/modules/angular2/test/change_detection/pipes/pipe_registry_spec.js @@ -22,7 +22,7 @@ export function main() { it("should throw when no matching type", () => { var r = new PipeRegistry({}); expect(() => r.get("unknown", "some object", null)).toThrowError( - `Cannot find a pipe for type 'unknown' object 'some object'` + `Cannot find 'unknown' pipe supporting object 'some object'` ); }); @@ -32,7 +32,7 @@ export function main() { }); expect(() => r.get("type", "some object", null)).toThrowError( - `Cannot find a pipe for type 'type' object 'some object'` + `Cannot find 'type' pipe supporting object 'some object'` ); }); }); @@ -54,4 +54,4 @@ class PipeFactory { create(cdRef):Pipe { return this.pipe; } -} \ No newline at end of file +}