You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve error messaging on missing configurations (#102)
Some watch faces might be using user configuration nodes without declaring them. These are invalid watch faces, so the code was not treating this case properly and we were getting generic exceptions. This change adds a special error message when this error happens.
Copy file name to clipboardExpand all lines: play-validations/memory-footprint/src/main/java/com/google/wear/watchface/dfx/memory/ResourceConfigTable.kt
+8-1Lines changed: 8 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -142,7 +142,14 @@ internal class ResourceConfigTable(
142
142
// in this object's resourceNameToKeys, replace each reference to a user config key with the
143
143
// top level user config definition, which contains all allowed values
144
144
val resourceNameToTopLevelKeys = resourceNameToKeys.entries().asSequence()
145
-
.map { it.key!! to userConfigKeys[it.value.keyId]!! }
145
+
.map {
146
+
val configurationId = it.value.keyId!!
147
+
if (userConfigKeys.containsKey(configurationId)) {
148
+
it.key!! to userConfigKeys[configurationId]!!
149
+
} else {
150
+
throwTestFailedException("Configuration $configurationId is not declared in UserConfigurations.")
Copy file name to clipboardExpand all lines: play-validations/memory-footprint/src/test/java/com/google/wear/watchface/dfx/memory/ResourceMemoryEvaluatorTest.java
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1118,6 +1118,24 @@ public void evaluateWatchFaceForLayout_failsOnMissingResource() throws Exception
0 commit comments