bricaud / graphexp

Interactive visualization of the Gremlin graph database with D3.js
Apache License 2.0
780 stars 215 forks source link

Fix to handle no data in websocket response #53

Closed antonyscerri closed 5 years ago

antonyscerri commented 5 years ago

Hi

As per your request this is the PR for issue #52 it has not been extensively tested so there may be side effects elsewhere.

Tony

antonyscerri commented 5 years ago

Playing more with responses, when you get back the websocket response you can get a null data value due to an actual error which currently seems to be being ignored altogether (before this PR it was treated as no data).

In the onmessage handler after parsing the response there probably ought to be a check on the response.status.code value as well to check for error codes, this was something mentioned in the related issues looking for 204 code. For now maybe just treating any 2XX code as a valid response and anything else report an error maybe sufficient. Some 2XX codes like 206 may want to report some kind of message but it depends if this is returned in practice (depends on the database).