Javascript getFunctionName()返回null

Javascript getFunctionName()返回null,javascript,node.js,Javascript,Node.js,我有以下node.js代码: var path = require('path'); var nodeStack = require('stack-trace'); var controller = (function () { function controller() { } controller.prototype.render = function (res, model, view) { var stack = nodeStack.get();

我有以下node.js代码:

var path = require('path');
var nodeStack = require('stack-trace');
var controller = (function () {
    function controller() {
    }
    controller.prototype.render = function (res, model, view) {
        var stack = nodeStack.get();
        var frame = stack[1];
        var functionName = frame.getFunctionName().split(/controller\./i);
        if (functionName.length < 2) {
            functionName = frame.getFunctionName().split(/(controller|\./i);
        }
        if (!view) {
            view = functionName[1];
            var dotidx = view.indexOf('.');
            if (dotidx > -1) {
                view = view.substring(0, dotidx);
            }
        }
        if (!model) {
            model = {};
        }
        var base = '';
        if (res.locals.basePath) {
            base = res.locals.basePath;
        }
        var cls = functionName[0];
        res.render(path.join(base, cls, view), model);
    };
    return controller;
})();
module.exports = controller;
一个不起作用的代码

customerController.prototype.details = function (req, res) {
    var _this = this;
    somepromise.then(function (provider) {
        return provider.getCustomerById(req.param('id'));
    }).then(function (customer) {
        _super.prototype.render.call(_this, res, { title: 'customer details', customer: customer });
    }, function (err) {
        res.status(404).send(err);
    });
};
该代码适用于除一个之外的所有方法。你知道为什么吗


备注:代码是从TypeScript编译的

可能是从闭包调用的?如果在getFunctionName返回null时记录帧,您会看到什么?@Kenney它们的样式都与我发布的样式相同。我将检查框架并添加它。@Kenney框架始终是空对象OK,这实际上是我的第一个想法-堆栈大小至少不是2(尽管我希望“尝试调用空对象上的函数”或其他)。或者,它不是空的,而是空的?可能会记录整个堆栈-它似乎是从你不期望的地方调用的。@Kenney,我检查过了,结果所有帧都是空对象。所以我现在真的迷路了:(
customerController.prototype.details = function (req, res) {
    var _this = this;
    somepromise.then(function (provider) {
        return provider.getCustomerById(req.param('id'));
    }).then(function (customer) {
        _super.prototype.render.call(_this, res, { title: 'customer details', customer: customer });
    }, function (err) {
        res.status(404).send(err);
    });
};