[sessionmgr][refactor] ApplyMutations() switch{} no longer has default.
This makes it a compile error, not a runtime error, when a new
StoryModelMutation command is introduced without updating
ApplyMutations().
TEST=apply_mutations_unittest
Change-Id: I7141093c446dd5409661995745c3c8bf3e167627
diff --git a/bin/sessionmgr/story/model/BUILD.gn b/bin/sessionmgr/story/model/BUILD.gn
index 6d6dfef..cb0518f 100644
--- a/bin/sessionmgr/story/model/BUILD.gn
+++ b/bin/sessionmgr/story/model/BUILD.gn
@@ -60,6 +60,7 @@
public_deps = [
"//peridot/public/fidl/fuchsia.modular.storymodel",
+ "//peridot/public/lib/fostr/fidl/fuchsia.modular.storymodel",
]
deps = [
diff --git a/bin/sessionmgr/story/model/apply_mutations.cc b/bin/sessionmgr/story/model/apply_mutations.cc
index 21c5b11..d0308ee 100644
--- a/bin/sessionmgr/story/model/apply_mutations.cc
+++ b/bin/sessionmgr/story/model/apply_mutations.cc
@@ -6,6 +6,8 @@
#include "peridot/bin/sessionmgr/story/model/apply_mutations.h"
+#include "lib/fostr/fidl/fuchsia/modular/storymodel/formatting.h"
+
using fuchsia::modular::StoryVisibilityState;
using fuchsia::modular::StoryState;
using fuchsia::modular::storymodel::StoryModel;
@@ -38,9 +40,8 @@
case StoryModelMutation::Tag::kSetRuntimeState:
ApplySetRuntimeState(command.set_runtime_state(), &new_model);
break;
- default:
- FXL_LOG(FATAL) << "Unsupported StoryModelMutation: "
- << fidl::ToUnderlying(command.Which());
+ case StoryModelMutation::Tag::Invalid:
+ FXL_LOG(FATAL) << "Encountered invalid StoryModelMutation: " << command;
}
}