MCPcopy Create free account
hub / github.com/couchbase/couchbase-python-client / raise_invalid_argument

Function raise_invalid_argument

src/exceptions.cxx:339–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337}
338
339PyObject*
340raise_invalid_argument(const char* message, const char* file, int line)
341{
342 // TODO: is this possible?
343 if (cached_invalid_argument_exc == nullptr) {
344 // Fallback to ValueError if exception not cached yet
345 PyErr_SetString(PyExc_ValueError, message);
346 return nullptr;
347 }
348
349 PyObject* args = PyTuple_New(0);
350 PyObject* kwargs = PyDict_New();
351 PyDict_SetItemString(kwargs, "message", PyUnicode_FromString(message));
352
353 PyObject* exc_info = build_exc_info_dict(file, line, message);
354 if (exc_info != nullptr) {
355 PyDict_SetItemString(kwargs, "exc_info", exc_info);
356 Py_DECREF(exc_info);
357 }
358
359 PyObject* exc = PyObject_Call(cached_invalid_argument_exc, args, kwargs);
360 Py_DECREF(args);
361 Py_DECREF(kwargs);
362
363 if (exc != nullptr) {
364 PyErr_SetObject(cached_invalid_argument_exc, exc);
365 Py_DECREF(exc);
366 }
367
368 return nullptr;
369}
370
371PyObject*
372raise_required_field_missing(PyObject* interned_key,

Calls

no outgoing calls

Tested by

no test coverage detected