diff --git a/zulip_bots/zulip_bots/bots/incident/incident.py b/zulip_bots/zulip_bots/bots/incident/incident.py index 05f50d5..fde3b6f 100644 --- a/zulip_bots/zulip_bots/bots/incident/incident.py +++ b/zulip_bots/zulip_bots/bots/incident/incident.py @@ -2,7 +2,7 @@ import html import json import random import re -from zulip_bots.lib import Any, StateHandlerError +from zulip_bots.lib import Any from typing import Optional, Any, Dict, Tuple @@ -79,7 +79,7 @@ def parse_answer(query: str) -> Tuple[str, str]: def generate_ticket_id(storage: Any) -> str: try: incident_num = storage.get('ticket_id') - except (StateHandlerError, KeyError): + except (KeyError): incident_num = 0 incident_num += 1 incident_num = incident_num % (1000) diff --git a/zulip_bots/zulip_bots/lib.py b/zulip_bots/zulip_bots/lib.py index d934aca..b8f2ed0 100644 --- a/zulip_bots/zulip_bots/lib.py +++ b/zulip_bots/zulip_bots/lib.py @@ -72,7 +72,7 @@ class StateHandler(object): response = self._client.get_storage({'keys': [key]}) if response['result'] != 'success': - raise StateHandlerError("Error fetching state: {}".format(str(response))) + raise KeyError('key not found: ' + key) marshalled_value = response['storage'][key] self.state_[key] = marshalled_value