Skip to content

Commit

Permalink
Websocket error handler (#54)
Browse files Browse the repository at this point in the history
* Fix to handle no data in websocket response and call callback or default handler

* Added handling of non 2XX websocket response codes as errors
  • Loading branch information
antonyscerri authored and bricaud committed Nov 24, 2018
1 parent 7944be3 commit b1a019b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/graphioGremlin.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,12 @@ var graphioGremlin = (function(){
};
ws.onmessage = function (event){
var response = JSON.parse(event.data);
var code=Number(response.status.code)
if(!isInt(code) || code<200 || code>299) {
$('#outputArea').html(response.status.message);
$('#messageArea').html("Error retrieving data");
return 1;
}
var data = response.result.data;
if (data == null){
if (query_type == 'editGraph'){
Expand Down

0 comments on commit b1a019b

Please sign in to comment.