From patchwork Mon Nov 16 16:02:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D9319: rust-status: properly translate OSError to Python From: phabricator X-Patchwork-Id: 47595 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Mon, 16 Nov 2020 16:02:59 +0000 Alphare created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY 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. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9319 AFFECTED FILES rust/hg-cpython/src/dirstate/status.rs CHANGE DETAILS To: Alphare, #hg-reviewers Cc: mercurial-patches, mercurial-devel diff --git a/rust/hg-cpython/src/dirstate/status.rs b/rust/hg-cpython/src/dirstate/status.rs --- a/rust/hg-cpython/src/dirstate/status.rs +++ b/rust/hg-cpython/src/dirstate/status.rs @@ -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::(py, &as_string) } + StatusError::IO(e) => PyErr::new::(py, e.to_string()), e => PyErr::new::(py, e.to_string()), } }