From 1b31a16d1384a5fd00b6830cbefe920ed9c4d29c Mon Sep 17 00:00:00 2001 From: Abhijeet Kaur Date: Mon, 6 Mar 2017 00:51:56 +0530 Subject: [PATCH] contrib bots: Better error handling response in thesaurus. --- contrib_bots/bots/thesaurus/thesaurus.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib_bots/bots/thesaurus/thesaurus.py b/contrib_bots/bots/thesaurus/thesaurus.py index fbee754..44345e8 100644 --- a/contrib_bots/bots/thesaurus/thesaurus.py +++ b/contrib_bots/bots/thesaurus/thesaurus.py @@ -34,10 +34,12 @@ def get_thesaurus_result(original_content): return help_message elif original_content.startswith('synonym'): result = get_clean_response(search_keyword, method = Dictionary.synonym) - return result elif original_content.startswith('antonym'): result = get_clean_response(search_keyword, method = Dictionary.antonym) - return result + + if result is None: + result = "Sorry, no result found! Please check the word." + return result class ThesaurusHandler(object): '''