diff --git a/app/adapters/application.coffee b/app/adapters/application.coffee index e5d41681..3ec51701 100644 --- a/app/adapters/application.coffee +++ b/app/adapters/application.coffee @@ -20,4 +20,9 @@ Adapter = DS.ActiveModelAdapter.extend findMany: (store, type, ids) -> @ajax(@buildURL(type.typeKey), 'GET', data: { ids: ids }) + handleResponse: (status, headers, payload) -> + if status > 299 + console.log "[ERROR] API responded with an error (#{status}): #{JSON.stringify(payload)}" + return @_super.apply(this, arguments) + `export default Adapter` diff --git a/app/utils/ajax.coffee b/app/utils/ajax.coffee index 11ef8686..c206845b 100644 --- a/app/utils/ajax.coffee +++ b/app/utils/ajax.coffee @@ -68,6 +68,7 @@ ajax = Em.Object.create options.error = (data, status, xhr) => Travis.lookup('controller:flash').pushObject(data.flash) if data?.flash delete data.flash if data? + console.log "[ERROR] API responded with an error (#{status}): #{JSON.stringify(data)}" error.apply(this, arguments) options = $.extend(options, default_options)