summaryrefslogtreecommitdiff
path: root/py_eval.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-04-27 10:08:42 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:31 -0400
commit0eb597a681115d6d5dd2ea4511fa3b8c7b3d9c9f (patch)
tree750d64f6817282a6f4744058f73164a2996f6b03 /py_eval.cc
parentd01629148383261d7944e91fd2ac67b334a6834d (diff)
downloadledger-0eb597a681115d6d5dd2ea4511fa3b8c7b3d9c9f.tar.gz
ledger-0eb597a681115d6d5dd2ea4511fa3b8c7b3d9c9f.tar.bz2
ledger-0eb597a681115d6d5dd2ea4511fa3b8c7b3d9c9f.zip
Restructured the code to use the new utility code in utils.h.
Diffstat (limited to 'py_eval.cc')
-rw-r--r--py_eval.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/py_eval.cc b/py_eval.cc
index 04be8750..6113b693 100644
--- a/py_eval.cc
+++ b/py_eval.cc
@@ -71,7 +71,7 @@ object python_interpreter_t::import(const string& str)
try {
PyObject * mod = PyImport_Import(PyString_FromString(str.c_str()));
if (! mod)
- throw error(string("Failed to import Python module ") + str);
+ throw_(exception, "Failed to import Python module " << str);
object newmod(handle<>(borrowed(mod)));
@@ -86,7 +86,7 @@ object python_interpreter_t::import(const string& str)
}
catch (const error_already_set&) {
PyErr_Print();
- throw error(string("Importing Python module ") + str);
+ throw_(exception, "Importing Python module " << str);
}
}
@@ -120,7 +120,7 @@ object python_interpreter_t::eval(std::istream& in, py_eval_mode_t mode)
}
catch (const error_already_set&) {
PyErr_Print();
- throw error("Evaluating Python code");
+ throw_(exception, "Evaluating Python code");
}
}
@@ -138,7 +138,7 @@ object python_interpreter_t::eval(const string& str, py_eval_mode_t mode)
}
catch (const error_already_set&) {
PyErr_Print();
- throw error("Evaluating Python code");
+ throw_(exception, "Evaluating Python code");
}
}
@@ -165,8 +165,8 @@ void python_interpreter_t::functor_t::operator()(value_t& result,
}
else if (PyObject * err = PyErr_Occurred()) {
PyErr_Print();
- throw new xml::xpath_t::calc_error
- (string("While calling Python function '") + name() + "'");
+ throw_(xml::xpath_t::calc_exception,
+ "While calling Python function '" << name() << "'");
} else {
assert(0);
}
@@ -177,8 +177,8 @@ void python_interpreter_t::functor_t::operator()(value_t& result,
}
catch (const error_already_set&) {
PyErr_Print();
- throw new xml::xpath_t::calc_error
- (string("While calling Python function '") + name() + "'");
+ throw_(xml::xpath_t::calc_exception,
+ "While calling Python function '" << name() << "'");
}
}
@@ -194,7 +194,8 @@ void python_interpreter_t::lambda_t::operator()(value_t& result,
}
catch (const error_already_set&) {
PyErr_Print();
- throw new xml::xpath_t::calc_error("While evaluating Python lambda expression");
+ throw_(xml::xpath_t::calc_exception,
+ "While evaluating Python lambda expression");
}
}