Improve error message when kernel not set (flutter/engine#6924)

Pushes the check up front so that we don't always land on the
application_kernel_list_asset error message, which may be misleading to
readers.

Also switches the empty check to only emit in debug builds, since this
is almost certainly not a runtime error but a programmer error.
This commit is contained in:
Chris Bracken
2018-11-26 11:29:56 -08:00
committed by GitHub
parent d920d87da2
commit 9555fe0167

View File

@@ -153,6 +153,13 @@ std::unique_ptr<IsolateConfiguration> IsolateConfiguration::InferFromSettings(
return nullptr;
}
if (settings.application_kernel_asset.empty() &&
settings.application_kernel_list_asset.empty()) {
FML_DLOG(ERROR) << "application_kernel_asset or "
"application_kernel_list_asset must be set";
return nullptr;
}
// Running from kernel snapshot.
{
std::unique_ptr<fml::Mapping> kernel =
@@ -164,10 +171,6 @@ std::unique_ptr<IsolateConfiguration> IsolateConfiguration::InferFromSettings(
// Running from kernel divided into several pieces (for sharing).
{
if (settings.application_kernel_list_asset.empty()) {
FML_LOG(ERROR) << "Application kernel list asset not set";
return nullptr;
}
std::unique_ptr<fml::Mapping> kernel_list =
asset_manager->GetAsMapping(settings.application_kernel_list_asset);
if (!kernel_list) {