Skip to content
This repository was archived by the owner on Jul 25, 2019. It is now read-only.
This repository was archived by the owner on Jul 25, 2019. It is now read-only.

Return error message to JS for invalid parameter cases instead of return undefined. #96

@DonnaWuDongxia

Description

@DonnaWuDongxia

We need to return the error message for invalid parameter cases.

NAN_METHOD(NanInstance::setCameraOptions) {
auto myself = ObjectWrap::Unwrap(info.Holder());

info.GetReturnValue().Set(Nan::Undefined());

if (info.Length() == 1 && ((info[0]->IsObject()))) {
// Method: name = setCameraOptions, taking 1 argument(s)

auto arg0 = EXTRACT_v8_object(info[0]);

// Return promise
myself->impl_->SetJavaScriptThis(info.This());
auto promise = myself->impl_->setCameraOptions(arg0);
info.GetReturnValue().Set(promise);

} // Closing bracket of 'if (info.Length() == 1)'

else {
// TODO: handle no-match by modifying template nanCxxImplMethod.def
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions