[Time Conductor] Warn about unknown formats

This commit is contained in:
Victor Woeltjen 2015-10-30 13:11:13 -07:00
parent 5a1d774b47
commit 6db7f056dc
2 changed files with 8 additions and 3 deletions

View File

@ -7,7 +7,7 @@
"provides": "formatService",
"type": "provider",
"implementation": "FormatProvider.js",
"depends": [ "formats[]" ]
"depends": [ "formats[]", "$log" ]
}
],
"formats": [

View File

@ -85,7 +85,7 @@ define([
* @param {Array.<function(new : Format)>} format constructors,
* from the `formats` extension category.
*/
function FormatProvider(formats) {
function FormatProvider(formats, $log) {
var formatMap = {};
function addToMap(Format) {
@ -97,10 +97,15 @@ define([
formats.forEach(addToMap);
this.formatMap = formatMap;
this.$log = $log;
}
FormatProvider.prototype.getFormat = function (key) {
return this.formatMap[key];
var format = this.formatMap[key];
if (!format) {
this.$log.warn("No format found for " + key);
}
return format;
};
return FormatProvider;