Mercurial > hg-stable
changeset 45876:c9c3c277e5a5
rust-status: properly translate OSError to Python
This is probably never going to be called after the next few patches, but we
might as well make sure this is done correctly for the future rewrite.
Differential Revision: https://phab.mercurial-scm.org/D9319
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 16 Nov 2020 16:36:00 +0100 |
parents | 073bb7563931 |
children | 5c736ba5dc27 |
files | rust/hg-cpython/src/dirstate/status.rs |
diffstat | 1 files changed, 2 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-cpython/src/dirstate/status.rs Mon Nov 16 21:28:42 2020 -0800 +++ b/rust/hg-cpython/src/dirstate/status.rs Mon Nov 16 16:36:00 2020 +0100 @@ -10,6 +10,7 @@ //! `rustext.dirstate.status`. use crate::{dirstate::DirstateMap, exceptions::FallbackError}; +use cpython::exc::OSError; use cpython::{ exc::ValueError, ObjectProtocol, PyBytes, PyErr, PyList, PyObject, PyResult, PyTuple, Python, PythonObject, ToPyObject, @@ -89,6 +90,7 @@ PyErr::new::<FallbackError, _>(py, &as_string) } + StatusError::IO(e) => PyErr::new::<OSError, _>(py, e.to_string()), e => PyErr::new::<ValueError, _>(py, e.to_string()), } }