Skip to content

Commit

Permalink
Improve error message when kernel not set (flutter#6924)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cbracken authored Nov 26, 2018
1 parent eebc6a5 commit f804a1f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions shell/common/isolate_configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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) {
Expand Down

0 comments on commit f804a1f

Please sign in to comment.