Skip to content

Commit 61595fb

Browse files
Specific try
The try inside of the allwatcher was a bit to greedy and caused issues where it would mask errors from being correctly diagnosed. This might unfortunately lead to some more bug reports about missing types etc, but I believe it's the right way to correctly handle KeyErrors.
1 parent 22002f3 commit 61595fb

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

juju/model.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -919,14 +919,15 @@ async def _all_watcher():
919919
for delta in results.deltas:
920920
try:
921921
entity = get_entity_delta(delta)
922-
old_obj, new_obj = self.state.apply_delta(entity)
923-
await self._notify_observers(entity, old_obj, new_obj)
924-
# Post step ensure that we can handle any settings
925-
# that need to be correctly set as a post step.
926-
_post_step(new_obj)
927922
except KeyError:
928923
if self.strict_mode:
929924
raise JujuError("unknown delta type '{}'".format(delta.entity))
925+
926+
old_obj, new_obj = self.state.apply_delta(entity)
927+
await self._notify_observers(entity, old_obj, new_obj)
928+
# Post step ensure that we can handle any settings
929+
# that need to be correctly set as a post step.
930+
_post_step(new_obj)
930931
self._watch_received.set()
931932
except CancelledError:
932933
pass

0 commit comments

Comments
 (0)