Skip to content

Commit

Permalink
[CLIENT-3106] Refactor aerospike.exception initialization code and ch…
Browse files Browse the repository at this point in the history
…eck if error indicator is set after calling a C-API method (#661)

- Doc: fix base class for QueryAbortError, ClusterError, AdminError, and QueryError
- Add regression tests for Aerospike exception classes
- Renamed test_error_code.py to test_exceptions.py
  • Loading branch information
juliannguyen4 authored Sep 9, 2024
1 parent f06a2bb commit d1e7bc2
Show file tree
Hide file tree
Showing 5 changed files with 495 additions and 566 deletions.
22 changes: 12 additions & 10 deletions doc/exception.rst
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,14 @@ Server Errors

Subclass of :py:exc:`~aerospike.exception.ServerError`.

.. py:exception:: QueryAbortedError
Query was aborted.

Error code: ``210``

Subclass of :py:exc:`~aerospike.exception.ServerError`.

Record Errors
-------------

Expand Down Expand Up @@ -397,14 +405,6 @@ Record Errors

Subclass of :py:exc:`~aerospike.exception.RecordError`.

.. py:exception:: QueryAbortedError
Query was aborted.

Error code: ``210``

Subclass of :py:exc:`~aerospike.exception.ClientError`.

Index Errors
------------

Expand Down Expand Up @@ -487,7 +487,7 @@ Query Errors

Error code: ``213``

Subclass of :py:exc:`~aerospike.exception.AerospikeError`.
Subclass of :py:exc:`~aerospike.exception.ServerError`.

Cluster Errors
--------------
Expand All @@ -507,7 +507,7 @@ Cluster Errors

Error code: ``11``

Subclass of :py:exc:`~aerospike.exception.AerospikeError`.
Subclass of :py:exc:`~aerospike.exception.ServerError`.

Admin Errors
------------
Expand All @@ -516,6 +516,8 @@ Admin Errors
The parent class for exceptions of the security API.

Subclass of :py:exc:`~aerospike.exception.ServerError`.

.. py:exception:: SecurityNotSupported
Security functionality not supported by connected server.
Expand Down
4 changes: 4 additions & 0 deletions src/main/aerospike.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ PyMODINIT_FUNC PyInit_aerospike(void)
py_global_hosts = PyDict_New();

PyObject *exception = AerospikeException_New();
if (exception == NULL) {
return NULL;
}

Py_INCREF(exception);
int retval = PyModule_AddObject(aerospike, "exception", exception);
if (retval == -1) {
Expand Down
Loading

0 comments on commit d1e7bc2

Please sign in to comment.