dianping/cat · error · Error
{formatterName} must be a string, function, or falsy value
Error message
{formatterName} must be a string, function, or falsy value What it means
Error "{formatterName} must be a string, function, or falsy value" thrown in dianping/cat.
Source
Thrown at cat-home/src/main/webapp/assets/js/uncompressed/select2.js:557
});
query.callback(filtered);
}
};
}
/**
* Checks if the formatter function should be used.
*
* Throws an error if it is not a function. Returns true if it should be used,
* false if no formatting should be performed.
*
* @param formatter
*/
function checkFormatter(formatter, formatterName) {
if ($.isFunction(formatter)) return true;
if (!formatter) return false;
if (typeof(formatter) === 'string') return true;
throw new Error(formatterName +" must be a string, function, or falsy value");
}
/**
* Returns a given value
* If given a function, returns its output
*
* @param val string|function
* @param context value of "this" to be passed to function
* @returns {*}
*/
function evaluate(val, context) {
if ($.isFunction(val)) {
var args = Array.prototype.slice.call(arguments, 2);
return val.apply(context, args);
}
return val;
}
View on GitHub (pinned to e815e74d4c)
Solutions
- Pass a string template, a formatter function, or omit the formatter option entirely.
- Check the formatSelection/formatResult option value for an invalid type.
When it happens
Trigger: Triggered when a Select2 formatter option (formatResult, formatSelection, etc.) is given a value that is neither a string, a function, nor falsy - e.g. a number or object.
Common situations: See trigger scenarios.
AI-assisted analysis of dianping/cat@e815e74d4c (2026-08-14).
Data as JSON: /api/errors/ff11842eb7838bb6.
Report an issue: GitHub.