mirror of
https://github.com/ruby-opencv/ruby-opencv
synced 2023-03-27 23:22:12 -04:00
added error handling to Curve methods
This commit is contained in:
parent
354d47830a
commit
a7e180a5db
1 changed files with 10 additions and 3 deletions
|
@ -95,9 +95,16 @@ rb_arc_length(int argc, VALUE *argv, VALUE self)
|
|||
{
|
||||
VALUE slice, is_closed;
|
||||
rb_scan_args(argc, argv, "02", &slice, &is_closed);
|
||||
return rb_float_new(cvArcLength(CVARR(self),
|
||||
double length = 0;
|
||||
try {
|
||||
length = cvArcLength(CVARR(self),
|
||||
NIL_P(slice) ? CV_WHOLE_SEQ : VALUE_TO_CVSLICE(slice),
|
||||
TRUE_OR_FALSE(is_closed, -1)));
|
||||
TRUE_OR_FALSE(is_closed, -1));
|
||||
}
|
||||
catch (cv::Exception& e) {
|
||||
raise_cverror(e);
|
||||
}
|
||||
return rb_float_new(length);
|
||||
}
|
||||
|
||||
__NAMESPACE_END_CURVE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue