From 5ed6e9248acf0e02618d6cab5b91a5c32e48d95c Mon Sep 17 00:00:00 2001 From: Dilawar Singh Date: Sat, 26 Sep 2020 00:50:42 +0530 Subject: [PATCH] Fixes to #429 --- pybind11/helper.h | 3 +++ python/moose/__init__.py | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pybind11/helper.h b/pybind11/helper.h index 72ebf4a1f3..5ccbac7f2c 100644 --- a/pybind11/helper.h +++ b/pybind11/helper.h @@ -176,6 +176,9 @@ inline bool mooseDeleteObj(const ObjId& oid) inline bool mooseDeleteStr(const string& path) { + auto o = ObjId(path); + if(o.bad()) + throw pybind11::value_error("Path '" + path + "' does not exists."); return getShellPtr()->doDelete(ObjId(path)); } diff --git a/python/moose/__init__.py b/python/moose/__init__.py index cdecb92873..a9b119c210 100644 --- a/python/moose/__init__.py +++ b/python/moose/__init__.py @@ -216,9 +216,7 @@ def connect(src, srcfield, dest, destfield, msgtype="Single"): def delete(arg): - """Delete the underlying moose object(s). This does not delete any of the - Python objects referring to this vec but does invalidate them. Any - attempt to access them will raise a ValueError. + """Delete the underlying moose object(s). Parameters ---------- @@ -227,7 +225,7 @@ def delete(arg): Returns ------- - None + None, Raises ValueError if given path/object does not exists. """ _moose.delete(arg)