ember 2.2.0 this.store.queryRecord返回错误:Error.EmberError处的新错误(本机)上的适配器操作失败

我正在使用带有ember-pouch的ember 2.2.0,所以我的问题是我试图通过不同于id的param从商店检索数据这里是我的代码:

this.store.queryRecord(’facility’,{api_number:’42 -001-1234′})

它失败了以下错误:

获取http:// localhost:4200 / facilities?api_number = 42-001-1234 404(未找到)发送@jquery.js:9664jQuery.extend.ajax @jquery.js:9215(匿名函数)@ rest-adapter.js :764initializePromise @ ember.debug.js:52308Promise @ ember.debug.js:54158ember $ data $ lib $ system $ adapter $$ default.extend.ajax @ rest-adapter.js:729ember $ data $ lib $ system $ adapter $ $ default.extend.queryRecord @ rest-adapter.js:404ember $ data $ lib $ system $ store $ finders $$ _ queryRecord @ finders.js:168ember $ data $ lib $ system $ store $$ Service.extend.queryRecord @ store .js:897chooseFacility @ facility.js:16_emberMetalMixin.Mixin.create.send @ ember.debug.js:31366runRegisteredAction @ ember.debug.js:28471Backburner.run @ ember.debug.js:681run @ ember.debug.js:20105actions .push.handler @ ember.debug.js:28465(匿名函数)@ ember.debug.js:43052jQuery.event.dispatch @jquery.js:4670elemData.handle @jquery.js:4338 ember.debug.js:30877错误:在Error.EmberError( http:// localhost:4200 / as )的新错误(本机)上,适配器操作失败 sets / vendor.js:26414:21 )在Error.ember $ data $ lib $ adapters $ errors $$ AdapterError( http:// localhost:4200 / assets / vendor.js:67497:50 )at ember $ data $ lib $ system $ adapter $$ default.extend.handleResponse( http:// localhost:4200 / assets / vendor.js:68801:16 )at hash.error( http:// localhost:4200 / assets / vendor.js:68881) :33 )at fire( http:// localhost:4200 / assets / vendor.js:3350:30 )at Object.self.fireWith [as rejectWith]( http:// localhost:4200 / assets / vendor.js:3462 :7 )at done( http:// localhost:4200 / assets / vendor.js:9518:14 )在XMLHttpRequest.callback( http:// localhost:4200 / assets / vendor.js:9920:8)onerrorDefault @ ember .debug.js:30877exports.default.trigger @ ember.debug.js:52928(匿名函数)@ ember.debug.js:54177Queue.invoke @ ember.debug.js:320Queue.flush @ ember.debug.js:384DeferredActionQueues .flush @ ember.debug.js:185Backburner.end @ ember.debug.js:563Backburner.run @ ember.debug.js:685run @ ember.debug.js:20105hash.error @ rest-adapter.js:761fire @jquery .js:3148self.fireWith @ jquery.js:3260done @jquery.js:9316callback @jquery.js:9718

看起来你的问题不在Ember方面,而在你的后端。 查询已正确转换为带有URL参数的GET请求,但您的后端服务器返回404.如果您使用返回的promise,例如:

this.store.queryRecord('facility', { api_number: '42-001-1234'}) .then(function(result) {...}) .catch(function(error) {...}); 

你可以处理exception。