Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[Android] Report an exception if there is an error. (#2393)
Browse files Browse the repository at this point in the history
* Report an exception if there is an error.

* Change  "__updateComponentData" to "UpdateComponentData"
  • Loading branch information
YorkShen authored and jianhan-he committed May 7, 2019
1 parent 6dee825 commit f6171bf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion weex_core/Source/core/bridge/eagle_bridge.cpp
Expand Up @@ -130,7 +130,7 @@ namespace WeexCore {
}

void EagleBridge::WeexCoreHandler::ReportException(const char* page_id, const char* func, const char* exception_string) {
WeexCore::WeexCoreManager::Instance()->getPlatformBridge()->platform_side()->ReportException(page_id, nullptr, exception_string);
WeexCore::WeexCoreManager::Instance()->getPlatformBridge()->platform_side()->ReportException(page_id, func, exception_string);
}

void EagleBridge::WeexCoreHandler::Send(const char* instance_id, const char* url, std::function<void(const std::string&)> callback) {
Expand Down
Expand Up @@ -448,7 +448,9 @@ int CoreSideInPlatform::CreateInstance(const char *instanceId, const char *func,
handler->CreatePage(script, instanceId, render_strategy, initData, exec_js);
}
else{
LOGE("DATA_RENDER mode should not be used if there is no data_render_handler");
WeexCore::WeexCoreManager::Instance()->getPlatformBridge()->platform_side()->ReportException(
instanceId, "CreatePageWithContent",
"There is no data_render_handler when createInstance with DATA_RENDER mode");
}

return true;
Expand Down Expand Up @@ -487,7 +489,9 @@ int CoreSideInPlatform::CreateInstance(const char *instanceId, const char *func,
handler->CreatePage(script, static_cast<size_t>(script_length), instanceId, option, env_str, initData, exec_js);
}
else{
LOGE("DATA_RENDER_BINARY mode should not be used if there is no data_render_handler");
WeexCore::WeexCoreManager::Instance()->getPlatformBridge()->platform_side()->ReportException(
instanceId, "CreatePageWithContent",
"There is no data_render_handler when createInstance with DATA_RENDER_BINARY mode");
}
return true;
}
Expand Down
10 changes: 9 additions & 1 deletion weex_core/Source/core/bridge/script/core_side_in_script.cpp
Expand Up @@ -469,7 +469,15 @@ void CoreSideInScript::OnReceivedResult(long callback_id,
void CoreSideInScript::UpdateComponentData(const char* page_id,
const char* cid,
const char* json_data) {
EagleBridge::GetInstance()->data_render_handler()->UpdateComponentData(page_id, cid, json_data);
auto handler = EagleBridge::GetInstance()->data_render_handler();
if(handler){
handler->UpdateComponentData(page_id, cid, json_data);
}
else{
WeexCore::WeexCoreManager::Instance()->getPlatformBridge()->platform_side()->ReportException(
page_id, "UpdateComponentData",
"There is no data_render_handler when UpdateComponentData invoked");
}
}

} // namespace WeexCore

0 comments on commit f6171bf

Please sign in to comment.