Don't error out if response is not valid JSON
This commit is contained in:
parent
1fa040d9a3
commit
895b52d7c4
|
@ -96,7 +96,10 @@ Travis.ajax = Em.Object.create
|
||||||
if xhr.readyState == 4
|
if xhr.readyState == 4
|
||||||
contentType = xhr.getResponseHeader('Content-Type')
|
contentType = xhr.getResponseHeader('Content-Type')
|
||||||
data = if contentType && contentType.match /application\/json/
|
data = if contentType && contentType.match /application\/json/
|
||||||
jQuery.parseJSON(xhr.responseText)
|
try
|
||||||
|
jQuery.parseJSON(xhr.responseText)
|
||||||
|
catch e
|
||||||
|
console.log('error while parsing a response', method, options.url, xhr.responseText)
|
||||||
else
|
else
|
||||||
xhr.responseText
|
xhr.responseText
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user