From 2a0a80b09a7b884a325efb716206f71aea228683 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 25 Apr 2019 19:45:18 -0700 Subject: [PATCH] Show error if ticket not found * Fixes issue #80 --- .bin/Scripts/functions/osticket.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.bin/Scripts/functions/osticket.py b/.bin/Scripts/functions/osticket.py index 30b7dd8a..89eeae1f 100644 --- a/.bin/Scripts/functions/osticket.py +++ b/.bin/Scripts/functions/osticket.py @@ -454,13 +454,17 @@ class osTicket(): if not re.match(r'^(\d+)$', _input): continue - # Valid ID entered, lookup name and verify + # Valid ID entered, lookup name try: _name = self.get_ticket_name(_input) except Exception: # Ignore and return None below break - if _name: + + # Verify + if _name is None: + print_error('ERROR: Ticket {} not found.'.format(_input)) + elif _name: print_standard('You have selected ticket #{} {}'.format( _input, _name)) if ask('Is this correct?'):