diff --git a/ChangeLog b/ChangeLog index 2968cfd..33d8576 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016.x.x, Version 2.x.x (BETA) + + - Check for correct types using assert in query method. + 2016.10.26, Version 2.0.3 (BETA) - Replaced logging failed ping to prevent unhandled error msg. (issue #2) diff --git a/siridb/twisted/lib/client.py b/siridb/twisted/lib/client.py index a03c8d8..6df787a 100644 --- a/siridb/twisted/lib/client.py +++ b/siridb/twisted/lib/client.py @@ -162,6 +162,12 @@ def query(self, query, timePrecision=None, timeout=60): see module doc-string for info on exception handling. ''' + assert isinstance(query, (str, unicode, bytes)), \ + 'query should be of type str, unicode or bytes' + + assert timePrecision is None or isinstance(timePrecision, int), \ + 'timePrecision should be None or an int type.' + tryUnavailable = True while True: factory = self._getRandomConnection(tryUnavailable)