diff --git a/edgedb/__init__.py b/edgedb/__init__.py index bf565921..353bdfcd 100644 --- a/edgedb/__init__.py +++ b/edgedb/__init__.py @@ -137,6 +137,7 @@ DuplicateFunctionDefinitionError, DuplicateConstraintDefinitionError, DuplicateCastDefinitionError, + DuplicateMigrationError, SessionTimeoutError, IdleSessionTimeoutError, QueryTimeoutError, @@ -147,6 +148,7 @@ DivisionByZeroError, NumericOutOfRangeError, AccessPolicyError, + QueryAssertionError, IntegrityError, ConstraintViolationError, CardinalityViolationError, @@ -155,11 +157,13 @@ TransactionConflictError, TransactionSerializationError, TransactionDeadlockError, + WatchError, ConfigurationError, AccessError, AuthenticationError, AvailabilityError, BackendUnavailableError, + ServerOfflineError, BackendError, UnsupportedBackendFeatureError, LogMessage, @@ -234,6 +238,7 @@ "DuplicateFunctionDefinitionError", "DuplicateConstraintDefinitionError", "DuplicateCastDefinitionError", + "DuplicateMigrationError", "SessionTimeoutError", "IdleSessionTimeoutError", "QueryTimeoutError", @@ -244,6 +249,7 @@ "DivisionByZeroError", "NumericOutOfRangeError", "AccessPolicyError", + "QueryAssertionError", "IntegrityError", "ConstraintViolationError", "CardinalityViolationError", @@ -252,11 +258,13 @@ "TransactionConflictError", "TransactionSerializationError", "TransactionDeadlockError", + "WatchError", "ConfigurationError", "AccessError", "AuthenticationError", "AvailabilityError", "BackendUnavailableError", + "ServerOfflineError", "BackendError", "UnsupportedBackendFeatureError", "LogMessage", diff --git a/edgedb/errors/__init__.py b/edgedb/errors/__init__.py index cfe55e1d..424edc91 100644 --- a/edgedb/errors/__init__.py +++ b/edgedb/errors/__init__.py @@ -94,6 +94,7 @@ 'AuthenticationError', 'AvailabilityError', 'BackendUnavailableError', + 'ServerOfflineError', 'BackendError', 'UnsupportedBackendFeatureError', 'LogMessage', @@ -440,6 +441,11 @@ class BackendUnavailableError(AvailabilityError): tags = frozenset({SHOULD_RETRY}) +class ServerOfflineError(AvailabilityError): + _code = 0x_08_00_00_02 + tags = frozenset({SHOULD_RECONNECT, SHOULD_RETRY}) + + class BackendError(EdgeDBError): _code = 0x_09_00_00_00 diff --git a/tests/test_async_query.py b/tests/test_async_query.py index bd9fd3a9..6058a980 100644 --- a/tests/test_async_query.py +++ b/tests/test_async_query.py @@ -61,12 +61,16 @@ async def test_async_parse_error_recover_01(self): with self.assertRaises(edgedb.EdgeQLSyntaxError): await self.client.query('select syntax error') - with self.assertRaisesRegex(edgedb.EdgeQLSyntaxError, - 'Unexpected end of line'): + with self.assertRaisesRegex( + edgedb.EdgeQLSyntaxError, + r"(Unexpected end of line)|(Missing '\)')" + ): await self.client.query('select (') - with self.assertRaisesRegex(edgedb.EdgeQLSyntaxError, - 'Unexpected end of line'): + with self.assertRaisesRegex( + edgedb.EdgeQLSyntaxError, + r"(Unexpected end of line)|(Missing '\)')" + ): await self.client.query_json('select (') for _ in range(10): diff --git a/tests/test_sync_query.py b/tests/test_sync_query.py index 8dd35c3c..399df28b 100644 --- a/tests/test_sync_query.py +++ b/tests/test_sync_query.py @@ -53,12 +53,16 @@ def test_sync_parse_error_recover_01(self): with self.assertRaises(edgedb.EdgeQLSyntaxError): self.client.query('select syntax error') - with self.assertRaisesRegex(edgedb.EdgeQLSyntaxError, - 'Unexpected end of line'): + with self.assertRaisesRegex( + edgedb.EdgeQLSyntaxError, + r"(Unexpected end of line)|(Missing '\)')" + ): self.client.query('select (') - with self.assertRaisesRegex(edgedb.EdgeQLSyntaxError, - 'Unexpected end of line'): + with self.assertRaisesRegex( + edgedb.EdgeQLSyntaxError, + r"(Unexpected end of line)|(Missing '\)')" + ): self.client.query_json('select (') for _ in range(10):