diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/node/src/node_request.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/platform/node/src/node_request.cpp b/platform/node/src/node_request.cpp index 211a696cd7..14af3ad5eb 100644 --- a/platform/node/src/node_request.cpp +++ b/platform/node/src/node_request.cpp @@ -65,16 +65,17 @@ NAN_METHOD(NodeRequest::Respond) { if (info.Length() < 1) { auto response = std::make_shared<mbgl::Response>(); - response->status = mbgl::Response::NotFound; + using Error = mbgl::Response::Error; + response->error = std::make_unique<Error>(Error::Reason::NotFound); source->notify(*resource, response); } else if (info[0]->BooleanValue()) { auto response = std::make_shared<mbgl::Response>(); - response->status = mbgl::Response::Error; - // Store the error string. const Nan::Utf8String message { info[0]->ToString() }; - response->message = std::string { *message, size_t(message.length()) }; + using Error = mbgl::Response::Error; + response->error = std::make_unique<Error>( + Error::Reason::Other, std::string{ *message, size_t(message.length()) }); source->notify(*resource, response); } else if (info.Length() < 2 || !info[1]->IsObject()) { @@ -83,8 +84,6 @@ NAN_METHOD(NodeRequest::Respond) { auto response = std::make_shared<mbgl::Response>(); auto res = info[1]->ToObject(); - response->status = mbgl::Response::Successful; - if (Nan::Has(res, Nan::New("modified").ToLocalChecked()).FromJust()) { const double modified = Nan::Get(res, Nan::New("modified").ToLocalChecked()).ToLocalChecked()->ToNumber()->Value(); if (!std::isnan(modified)) { |