| 136 | } |
| 137 | |
| 138 | int |
| 139 | git_error_for_exc(void) |
| 140 | { |
| 141 | PyObject *err = PyErr_Occurred(); |
| 142 | if (err) { |
| 143 | // FIXME Here we're masking exception, if the Python implementation has |
| 144 | // a genuine Key or Value error. We should have an explicit way for the |
| 145 | // Python callbacks to signal ENOTFOUND (and EAMBIGUOUS?) |
| 146 | |
| 147 | // Not found is an expected condition (the ODB will try with the next |
| 148 | // backend), so we clear the exception. |
| 149 | if (PyErr_GivenExceptionMatches(err, PyExc_KeyError)) { |
| 150 | PyErr_Clear(); |
| 151 | return GIT_ENOTFOUND; |
| 152 | } |
| 153 | |
| 154 | if (PyErr_GivenExceptionMatches(err, PyExc_ValueError)) |
| 155 | return GIT_EAMBIGUOUS; |
| 156 | |
| 157 | return GIT_EUSER; |
| 158 | } |
| 159 | |
| 160 | return 0; |
| 161 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…