{"record":{"id":"ff11842eb7838bb6","repo":"dianping/cat","slug":"formattername-must-be-a-string-function-or-fal","errorCode":null,"errorMessage":"{formatterName} must be a string, function, or falsy value","messagePattern":"(.+?) must be a string, function, or falsy value","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cat-home/src/main/webapp/assets/js/uncompressed/select2.js","lineNumber":557,"sourceCode":"                });\n                query.callback(filtered);\n            }\n        };\n    }\n\n    /**\n     * Checks if the formatter function should be used.\n     *\n     * Throws an error if it is not a function. Returns true if it should be used,\n     * false if no formatting should be performed.\n     *\n     * @param formatter\n     */\n    function checkFormatter(formatter, formatterName) {\n        if ($.isFunction(formatter)) return true;\n        if (!formatter) return false;\n        if (typeof(formatter) === 'string') return true;\n        throw new Error(formatterName +\" must be a string, function, or falsy value\");\n    }\n\n  /**\n   * Returns a given value\n   * If given a function, returns its output\n   *\n   * @param val string|function\n   * @param context value of \"this\" to be passed to function\n   * @returns {*}\n   */\n    function evaluate(val, context) {\n        if ($.isFunction(val)) {\n            var args = Array.prototype.slice.call(arguments, 2);\n            return val.apply(context, args);\n        }\n        return val;\n    }\n","sourceCodeStart":539,"sourceCodeEnd":575,"githubUrl":"https://github.com/dianping/cat/blob/e815e74d4c2dd74edac831241f1253fcc7d25381/cat-home/src/main/webapp/assets/js/uncompressed/select2.js#L539-L575","documentation":"Error \"{formatterName} must be a string, function, or falsy value\" thrown in dianping/cat.","triggerScenarios":"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.","commonSituations":"See trigger scenarios.","solutions":["Pass a string template, a formatter function, or omit the formatter option entirely.","Check the formatSelection/formatResult option value for an invalid type."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e815e74d4c2dd74edac831241f1253fcc7d25381","analyzedAt":"2026-08-14T14:22:34.512Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}