From ebfddaaace0a3b545d868bcf42840fb0bf11b6b4 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Tue, 4 Dec 2018 17:05:03 +0000 Subject: [PATCH] ui: ember-data AbortError should have a `0` status (#5048) --- ui-v2/app/adapters/application.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ui-v2/app/adapters/application.js b/ui-v2/app/adapters/application.js index aa3555059d..c673abbb6a 100644 --- a/ui-v2/app/adapters/application.js +++ b/ui-v2/app/adapters/application.js @@ -1,4 +1,5 @@ import Adapter from 'ember-data/adapters/rest'; +import { AbortError } from 'ember-data/adapters/errors'; import { inject as service } from '@ember/service'; import URL from 'url'; @@ -17,6 +18,22 @@ import { HEADERS_SYMBOL as HTTP_HEADERS_SYMBOL } from 'consul-ui/utils/http/cons export default Adapter.extend({ namespace: 'v1', repo: service('settings'), + queryRecord: function() { + return this._super(...arguments).catch(function(e) { + if (e instanceof AbortError) { + e.errors[0].status = '0'; + } + throw e; + }); + }, + query: function() { + return this._super(...arguments).catch(function(e) { + if (e instanceof AbortError) { + e.errors[0].status = '0'; + } + throw e; + }); + }, headersForRequest: function(params) { return { ...this.get('repo').findHeaders(),