I want to handle error if any model api get failed. I couldn't figure out, how can i handle it
Here is more controller
index: function(params, callback) {
var phoneNo = params['phoneNo'];
var spec = {
model: {model: 'Email', params: params},
email: {model: 'Email', params: params},
phone: {model: 'Phone', params: params},
user: {model: 'User', params: params}
};
if(phoneNo){
spec['hexagon'] = {model: 'Hexagon', params: params1};
}
this.app.fetch(spec, {'timeout' : 5000}, function(err, result) {
callback(err, result);
});
In case if my Hexagon model get failed then it directly through the error and server show error like below
Error: ERROR fetching model 'hexagon' with options '{"parse":true,"headers":{"auth-key":"098bc240588033041ea1e6e47e9b880","User-Agent":"Rendr RestAdapter; Node.js"},"timeout":5000,"data":{"phoneNo":"XXXX","emailId":"XXX","userId":"123XXX}}'. Response: {"body":"<title>404: Not Found</title>404: Not Found","status":404}
at error (/Users/kkc/Downloads/scrapbroker/src/admin_dashboard/node_modules/rendr/shared/fetcher.js:188:15)
at Object.options.error (/Users/kkc/Downloads/scrapbroker/src/admin_dashboard/node_modules/backbone/backbone.js:1914:24)
at /Users/kkc/Downloads/scrapbroker/src/admin_dashboard/node_modules/rendr/shared/syncer.js:99:17
at RestAdapter. (/Users/kkc/Downloads/scrapbroker/src/admin_dashboard/node_modules/rendr/server/data_adapter/rest_adapter.js:97:5)
at Request.self.callback (/Users/kkc/Downloads/scrapbroker/src/admin_dashboard/node_modules/request/request.js:185:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request. (/Users/kkc/Downloads/scrapbroker/src/admin_dashboard/node_modules/request/request.js:1161:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
Is there any way where I can handle this error on controller or model side.
I want to handle error if any model api get failed. I couldn't figure out, how can i handle it
Here is more controller
index: function(params, callback) {
var phoneNo = params['phoneNo'];
var spec = {
model: {model: 'Email', params: params},
email: {model: 'Email', params: params},
phone: {model: 'Phone', params: params},
user: {model: 'User', params: params}
};
if(phoneNo){
spec['hexagon'] = {model: 'Hexagon', params: params1};
}
this.app.fetch(spec, {'timeout' : 5000}, function(err, result) {
callback(err, result);
});
In case if my Hexagon model get failed then it directly through the error and server show error like below
Error: ERROR fetching model 'hexagon' with options '{"parse":true,"headers":{"auth-key":"098bc240588033041ea1e6e47e9b880","User-Agent":"Rendr RestAdapter; Node.js"},"timeout":5000,"data":{"phoneNo":"XXXX","emailId":"XXX","userId":"123XXX}}'. Response: {"body":"<title>404: Not Found</title>404: Not Found","status":404}
at error (/Users/kkc/Downloads/scrapbroker/src/admin_dashboard/node_modules/rendr/shared/fetcher.js:188:15)
at Object.options.error (/Users/kkc/Downloads/scrapbroker/src/admin_dashboard/node_modules/backbone/backbone.js:1914:24)
at /Users/kkc/Downloads/scrapbroker/src/admin_dashboard/node_modules/rendr/shared/syncer.js:99:17
at RestAdapter. (/Users/kkc/Downloads/scrapbroker/src/admin_dashboard/node_modules/rendr/server/data_adapter/rest_adapter.js:97:5)
at Request.self.callback (/Users/kkc/Downloads/scrapbroker/src/admin_dashboard/node_modules/request/request.js:185:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request. (/Users/kkc/Downloads/scrapbroker/src/admin_dashboard/node_modules/request/request.js:1161:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
Is there any way where I can handle this error on controller or model side.