mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
Return error instead of throw
This commit is contained in:
parent
585790f06e
commit
77b72dc350
@ -27,6 +27,11 @@ NAN_METHOD(OpenCV::ReadImage) {
|
||||
|
||||
REQ_FUN_ARG(1, cb);
|
||||
|
||||
Local<Value> argv[2];
|
||||
|
||||
argv[0] = NanNull();
|
||||
argv[1] = im_h;
|
||||
|
||||
if (args[0]->IsNumber() && args[1]->IsNumber()){
|
||||
int width, height;
|
||||
|
||||
@ -47,17 +52,12 @@ NAN_METHOD(OpenCV::ReadImage) {
|
||||
mat = cv::imdecode(*mbuf, -1);
|
||||
|
||||
if (mat.empty()){
|
||||
NanThrowTypeError("Error loading file");
|
||||
argv[0] = NanError("Error loading file");
|
||||
}
|
||||
}
|
||||
|
||||
img->mat = mat;
|
||||
|
||||
Local<Value> argv[2];
|
||||
|
||||
argv[0] = NanNull();
|
||||
argv[1] = im_h;
|
||||
|
||||
TryCatch try_catch;
|
||||
|
||||
cb->Call(NanGetCurrentContext()->Global(), 2, argv);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user