| 185 | // Python exception <-> Status |
| 186 | |
| 187 | Status ConvertPyError(StatusCode code) { |
| 188 | auto detail = PythonErrorDetail::FromPyError(); |
| 189 | if (code == StatusCode::UnknownError) { |
| 190 | code = MapPyError(detail->exc_type()); |
| 191 | } |
| 192 | |
| 193 | std::string message; |
| 194 | RETURN_NOT_OK(internal::PyObject_StdStringStr(detail->exc_value(), &message)); |
| 195 | return Status(code, message, detail); |
| 196 | } |
| 197 | |
| 198 | bool IsPyError(const Status& status) { |
| 199 | if (status.ok()) { |