diff --git a/SingularityUI/app/application.coffee b/SingularityUI/app/application.coffee index 693b79bc62..21e0d537e2 100644 --- a/SingularityUI/app/application.coffee +++ b/SingularityUI/app/application.coffee @@ -113,9 +113,16 @@ class Application message: "

Could not reach the Singularity API. Please make sure SingularityUI is properly set up.

If running through Brunch, this might be your browser blocking cross-domain requests.

" else try - serverMessage = JSON.parse(jqxhr.responseText).message or jqxhr.responseText + serverMessage = JSON.parse(jqxhr.responseText).message or jqxhr.responseText catch - serverMessage = jqxhr.responseText + if jqxhr.status is 200 + console.error jqxhr.responseText + Messenger().error + message: """ +

Expected JSON but received #{if jqxhr.responseText.startsWith '' then 'html' else 'something else'}. The response has been saved to your js console.

+ """ + throw new Error "Expected JSON in response but received #{if jqxhr.responseText.startsWith '' then 'html' else 'something else'}" + serverMessage = jqxhr.responseText serverMessage = _.escape serverMessage id = "message_" + Date.now()