Skip to content

Commit

Permalink
fix: ignore invalid state transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
bbangert committed Sep 7, 2018
1 parent 844ecc2 commit 464e5f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ where
| Err(Error(ErrorKind::Io(_), _))
| Err(Error(ErrorKind::PongTimeout, _))
| Err(Error(ErrorKind::RepeatUaidDisconnect, _))
| Err(Error(ErrorKind::ExcessivePing, _)) => None,
| Err(Error(ErrorKind::ExcessivePing, _))
| Err(Error(ErrorKind::InvalidStateTransition(_, _), _)) => None,
Err(e) => Some(e),
}
};
Expand Down
13 changes: 7 additions & 6 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ def sentry_handler():
}


class CustomClient(Client):
def send_bad_data(self):
self.ws.send("bad-data")


def setup_module():
global CN_SERVER, CN_QUEUES, CN_MP_SERVER, MOCK_SERVER_THREAD
ap_tests.ddb_jar = os.path.join(root_dir, "ddb", "DynamoDBLocal.jar")
Expand Down Expand Up @@ -303,14 +308,10 @@ def _ws_url(self):

@inlineCallbacks
def test_sentry_output(self):
client = Client(self._ws_url)
client = CustomClient(self._ws_url)
yield client.connect()
yield client.hello()
# Send a duplicate hello
try:
yield client.hello()
except ValueError:
pass
yield client.send_bad_data()
yield self.shut_down(client)
data = MOCK_SENTRY_QUEUE.get(timeout=1)
assert data["exception"]["values"][0]["value"].startswith("invalid")
Expand Down

0 comments on commit 464e5f9

Please sign in to comment.