refactor(PipeRegistry): improve error messages

Closes #1504
This commit is contained in:
Pawel Kozlowski
2015-04-23 15:27:20 +02:00
committed by Misko Hevery
parent fa8e059f28
commit d0059b5d75
2 changed files with 6 additions and 6 deletions

View File

@ -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);
}
}
}