javascript - Abort accessing success callback in backbone model -
i have backbone model consist of following parse method.
parse: function(response, options){ // handling error http response 200 if( response.reasons && response.reasons[0] ){ var errorresponse = { responsejson: { reasons: [ { code: response.reasons[0].reasoncode, reason: '' } ] } } options.error( errorresponse ); return errorresponse; } }
my issue is, web service won't give http response 500 errors. need check response & decide that. problem is, above code runs error callback after goes success callback well. need stop that.
i receive json response server, similar following
{data: {some data}}
for error
{data: {}, reasons: [{error code}]}
please let me know how can that. in advance
backbone default expects response json
, if json
returned server success callback triggered. out overriding fetch method of backbone, can't stop triggering success.
Comments
Post a Comment