Hi chaiscript team.
i just want to know how to get exception error line on the script.
// imported function
std::shared_ptroc::ocImage imread(std::string _path, bool _isColor) {
cv::ImreadModes mode = cv::IMREAD_GRAYSCALE;
if (_isColor)
mode = cv::IMREAD_COLOR;
cv::Mat cvImage = cv::imread(_path, mode);
if (cvImage.empty()) {
OCERROR(error)
OCERRORWRITE(error, "image file not found")
throw std::runtime_error(error);
}
int depth = 1;
if (cvImage.depth() == CV_8U || cvImage.depth() == CV_8S)
depth = 1;
else if (cvImage.depth() == CV_16U || cvImage.depth() == CV_16S)
depth = 2;
std::shared_ptr<oc::ocImage> image = std::shared_ptr<oc::ocImage>(new oc::ocImage(cvImage.cols, cvImage.rows, cvImage.channels(), depth, cvImage.data));
return image;
}
/// Script txt
import("cv");
var image1 = cv.imread("D:\Github\OpenScript\TestScript\Lenna.png",false);
var test2 = cv.imread("D:\Github\OpenScript\TestScript\Lenna.png",true);
as you can see this function i made throw std::runtime_exception contain error information.
(this error info contain error line , ex: LINE , FUNCTION, with using custom macro function OCERROR)
but it not means that this throw contain error line on script like chaiscript::exception::eval_error's start_position.line, start_position.column
if i need to modify chaiscript source code ,,,, could you let me know how to do?
Thanks
Hi chaiscript team.
i just want to know how to get exception error line on the script.
// imported function
std::shared_ptroc::ocImage imread(std::string _path, bool _isColor) {
}
/// Script txt
import("cv");
var image1 = cv.imread("D:\Github\OpenScript\TestScript\Lenna.png",false);
var test2 = cv.imread("D:\Github\OpenScript\TestScript\Lenna.png",true);
as you can see this function i made throw std::runtime_exception contain error information.
(this error info contain error line , ex: LINE , FUNCTION, with using custom macro function OCERROR)
but it not means that this throw contain error line on script like chaiscript::exception::eval_error's start_position.line, start_position.column
if i need to modify chaiscript source code ,,,, could you let me know how to do?
Thanks