parent
fa8e059f28
commit
d0059b5d75
|
@ -15,14 +15,14 @@ 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);
|
||||
|
|
|
@ -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'`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue