Add debug info on ajax errors
This commit is contained in:
parent
61e445381c
commit
3827b6b4d8
|
@ -20,4 +20,9 @@ Adapter = DS.ActiveModelAdapter.extend
|
||||||
findMany: (store, type, ids) ->
|
findMany: (store, type, ids) ->
|
||||||
@ajax(@buildURL(type.typeKey), 'GET', data: { ids: 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`
|
`export default Adapter`
|
||||||
|
|
|
@ -68,6 +68,7 @@ ajax = Em.Object.create
|
||||||
options.error = (data, status, xhr) =>
|
options.error = (data, status, xhr) =>
|
||||||
Travis.lookup('controller:flash').pushObject(data.flash) if data?.flash
|
Travis.lookup('controller:flash').pushObject(data.flash) if data?.flash
|
||||||
delete data.flash if data?
|
delete data.flash if data?
|
||||||
|
console.log "[ERROR] API responded with an error (#{status}): #{JSON.stringify(data)}"
|
||||||
error.apply(this, arguments)
|
error.apply(this, arguments)
|
||||||
|
|
||||||
options = $.extend(options, default_options)
|
options = $.extend(options, default_options)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user