mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-29 00:22:00 +00:00
ENH: add more error conversions
This commit is contained in:
parent
61d67f0462
commit
2b9fdbe7c9
@ -297,6 +297,12 @@ private:
|
|||||||
} catch (const error_already_set &) { return nullptr;
|
} catch (const error_already_set &) { return nullptr;
|
||||||
} catch (const index_error &e) { PyErr_SetString(PyExc_IndexError, e.what()); return nullptr;
|
} catch (const index_error &e) { PyErr_SetString(PyExc_IndexError, e.what()); return nullptr;
|
||||||
} catch (const stop_iteration &e) { PyErr_SetString(PyExc_StopIteration, e.what()); return nullptr;
|
} catch (const stop_iteration &e) { PyErr_SetString(PyExc_StopIteration, e.what()); return nullptr;
|
||||||
|
} catch (const std::bad_alloc &e) { PyErr_SetString(PyExc_MemoryError, e.what()); return nullptr;
|
||||||
|
} catch (const std::domain_error &e) { PyErr_SetString(PyExc_ValueError, e.what()); return nullptr;
|
||||||
|
} catch (const std::invalid_argument &e) { PyErr_SetString(PyExc_ValueError, e.what()); return nullptr;
|
||||||
|
} catch (const std::length_error &e) { PyErr_SetString(PyExc_ValueError, e.what()); return nullptr;
|
||||||
|
} catch (const std::out_of_range &e) { PyErr_SetString(PyExc_IndexError, e.what()); return nullptr;
|
||||||
|
} catch (const std::range_error &e) { PyErr_SetString(PyExc_ValueError, e.what()); return nullptr;
|
||||||
} catch (const std::exception &e) { PyErr_SetString(PyExc_RuntimeError, e.what()); return nullptr;
|
} catch (const std::exception &e) { PyErr_SetString(PyExc_RuntimeError, e.what()); return nullptr;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
PyErr_SetString(PyExc_RuntimeError, "Caught an unknown exception!");
|
PyErr_SetString(PyExc_RuntimeError, "Caught an unknown exception!");
|
||||||
|
Loading…
Reference in New Issue
Block a user