Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling model Error if one model fail to give data in controller #523

Open
krishna1st opened this issue Sep 28, 2018 · 2 comments
Open

Comments

@krishna1st
Copy link

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.

@ghost
Copy link

ghost commented Jan 26, 2019

@krishna1st based on commit history it appears this repo is no longer maintained by Airbnb

@alexindigo
Copy link
Member

@krishna1st Yes, Airbnb released it some time ago, so it's up for grabs. And all other involved parties moved on to React (or Vue) based frameworks like Next.js

If you're invested a lot into this project, feel free to create PR and we'll get it merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants