This source file includes following definitions.
- translate_error
- translate_runtime_error
- translate_compile_error
- translate_internal_error
- defineError
#include "Error.h"
#include <boost/python.hpp>
#include "Halide.h"
#include <string>
namespace h = Halide;
namespace p = boost::python;
void translate_error(h::Error const &e) {
PyErr_SetString(PyExc_RuntimeError,
(std::string("Halide Error: ") + e.what()).c_str());
return;
}
void translate_runtime_error(h::RuntimeError const &e) {
PyErr_SetString(PyExc_RuntimeError,
(std::string("Halide RuntimeError: ") + e.what()).c_str());
return;
}
void translate_compile_error(h::CompileError const &e) {
PyErr_SetString(PyExc_RuntimeError,
(std::string("Halide CompileError: ") + e.what()).c_str());
return;
}
void translate_internal_error(h::InternalError const &e) {
PyErr_SetString(PyExc_RuntimeError,
(std::string("Halide InternalError: ") + e.what()).c_str());
return;
}
void defineError() {
p::register_exception_translator<h::Error>(&translate_error);
p::register_exception_translator<h::RuntimeError>(&translate_runtime_error);
p::register_exception_translator<h::CompileError>(&translate_compile_error);
p::register_exception_translator<h::InternalError>(&translate_internal_error);
return;
}