bots: Raise KeyError inside storage.get().

Our bots rely on get() raising `KeyError` if
a key does not exist.

This was a regression in this commit:

d7d2f6bbd6
This commit is contained in:
Steve Howell 2018-12-09 17:31:06 +00:00 committed by showell
parent f191d44992
commit 3d68e394dc
2 changed files with 3 additions and 3 deletions

View file

@ -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)