MCPcopy Create free account
hub / github.com/ashvardanian/StringZilla / set_stringzilla_error

Function set_stringzilla_error

python/stringzillas.c:54–65  ·  view source on GitHub ↗

* @brief Set appropriate Python exception based on StringZilla status code and error detail. * @param[in] status The StringZilla status code * @param[in] error_detail Detailed error message from StringZilla (never NULL) * @param[in] context Context string describing the operation (e.g., "Levenshtein initialization") */

Source from the content-addressed store, hash-verified

52 * @param[in] context Context string describing the operation (e.g., "Levenshtein initialization")
53 */
54static void set_stringzilla_error(sz_status_t status, char const *error_detail, char const *context) {
55 switch (status) {
56 case sz_bad_alloc_k: PyErr_Format(PyExc_MemoryError, "%s: %s", context, error_detail); break;
57 case sz_invalid_utf8_k: PyErr_Format(PyExc_ValueError, "%s: %s", context, error_detail); break;
58 case sz_overflow_risk_k: PyErr_Format(PyExc_OverflowError, "%s: %s", context, error_detail); break;
59 case sz_unexpected_dimensions_k: PyErr_Format(PyExc_ValueError, "%s: %s", context, error_detail); break;
60 case sz_missing_gpu_k:
61 case sz_device_code_mismatch_k:
62 case sz_device_memory_mismatch_k:
63 default: PyErr_Format(PyExc_RuntimeError, "%s: %s", context, error_detail); break;
64 }
65}
66
67#pragma region Forward Declarations
68

Callers 12

DeviceScope_initFunction · 0.85
NeedlemanWunsch_initFunction · 0.85
NeedlemanWunsch_callFunction · 0.85
SmithWaterman_initFunction · 0.85
SmithWaterman_callFunction · 0.85
Fingerprints_initFunction · 0.85
Fingerprints_callFunction · 0.85
PyInit_stringzillasFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…