节点错误对象 Fumble

BSD
JavaScript
跨平台
Yahoo
2015-05-11
孔小菜

Fumble 是简单的节点里的错误对象。专门为 fetchr 库创建,基于 hapi.js

示例代码:

var fumble = require('fumble');
var callAndProcess = require('./callAndProcess');
module.exports = require('api').base.service({
    name: 'foo',    
    read: function (req, resource, params, context, callback) {        
    switch(resource) {            
        case this.name: 
                callAndProcess(req, params, context, callback);                
                return;
        }        
var error = fumble.http.create(400, 'Passed in an invalid resource', {
            debug: [resource]
        });

        req.error(error);
        req.debug(error.stack); 
        // nice stack trace
        /**        
        * logs:        
        * { [HttpError: Bad Request] statusCode: 400, message:         
        * 'Passed in an invalid resource', debug: [ resource ] }        
        */
        callback(error);
    }
});


加载中

评论(0)

暂无评论

暂无资讯

暂无问答

The numbers, here late in the

The numbers, here late in the

2015/05/16 11:37
1
0
the pass just before it land

the pass just before it land

2015/07/04 14:05
4
0
Lovie Johnson: Buccaneers' crime 'not necessarily

Lovie Johnson: Buccaneers' crime 'not necessarily ready

2014/10/14 11:26
5
0
Live NFL playoff probability updates for Week 14

There's a lot they must clean up, but there are no style points awarded in December. The Redskins got what they needed....

2016/12/13 10:11
1
0
What he did was historic

We discussed what we had seen from Ajayi in that game, how he had dominated the Dolphins' running back touches and how cheap jerseys head coach Adam Gase had been public about w...

2016/11/10 16:37
1
0

没有更多内容

加载失败,请刷新页面

返回顶部
顶部