Skip to main content
Version: 2.5.0

Python Client Error Codes

All Client methods return a plain int status code. A return value of 0 means success — any negative value indicates an error. The Python binding returns the same integer values as the underlying C++ ClientErrorCode enum.

Error Code Table

Code nameValueDescription
CL_SUCCESS0Operation completed successfully
CL_ERR_UNKNOWN-1Generic/unexpected error
CL_ERR_INVALID_ARG-2Invalid argument or parameter
CL_ERR_NOT_EXIST-3Chronicle or Story does not exist
CL_ERR_ACQUIRED-4Resource is acquired and cannot be destroyed
CL_ERR_NOT_ACQUIRED-5Resource is not acquired and cannot be released
CL_ERR_CHRONICLE_EXISTS-6Chronicle with that name already exists
CL_ERR_NO_KEEPERS-7No ChronoKeeper nodes available
CL_ERR_NO_CONNECTION-8No connection to ChronoVisor
CL_ERR_NOT_AUTHORIZED-9Operation not authorized
CL_ERR_NO_PLAYERS-10No ChronoPlayer nodes available
CL_ERR_NOT_READER_MODE-11Client is in WRITER_MODE; read operations unavailable
CL_ERR_QUERY_TIMED_OUT-12Replay query timed out

Error Handling

Since the Python binding returns raw integers, check return codes with simple comparisons or a lookup table:

import py_chronolog_client

ERROR_NAMES = {
0: "CL_SUCCESS",
-1: "CL_ERR_UNKNOWN",
-2: "CL_ERR_INVALID_ARG",
-3: "CL_ERR_NOT_EXIST",
-4: "CL_ERR_ACQUIRED",
-5: "CL_ERR_NOT_ACQUIRED",
-6: "CL_ERR_CHRONICLE_EXISTS",
-7: "CL_ERR_NO_KEEPERS",
-8: "CL_ERR_NO_CONNECTION",
-9: "CL_ERR_NOT_AUTHORIZED",
-10: "CL_ERR_NO_PLAYERS",
-11: "CL_ERR_NOT_READER_MODE",
-12: "CL_ERR_QUERY_TIMED_OUT",
}

portal_conf = py_chronolog_client.ClientPortalServiceConf("ofi+sockets", "127.0.0.1", 5555, 55)
client = py_chronolog_client.Client(portal_conf)

ret = client.Connect()
if ret != 0:
print(f"Connect failed: {ERROR_NAMES.get(ret, ret)}")
else:
print("Connected successfully")

ret = client.CreateChronicle("MyChronicle", {}, 1)
if ret == 0 or ret == -6: # success or already exists — both are acceptable
print("Chronicle ready")
else:
print(f"CreateChronicle failed: {ERROR_NAMES.get(ret, ret)}")