From 9b48127c4646244c7893350c3522c1fa6b9a742a Mon Sep 17 00:00:00 2001 From: vunhat_minh Date: Fri, 31 Jul 2015 16:43:03 +0900 Subject: [PATCH] Display detail error when over 140 character limit --- docs/conf.py | 4 ++-- rainbowstream/rainbow.py | 31 ++++++++++--------------------- setup.py | 2 +- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index b5aaf71..3c2d6aa 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,9 +48,9 @@ copyright = u'2014, Vu Nhat Minh' # built documents. # # The short X.Y version. -version = '1.2.9' +version = '1.3.0' # The full version, including alpha/beta/rc tags. -release = '1.2.9' +release = '1.3.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/rainbowstream/rainbow.py b/rainbowstream/rainbow.py index e7eede6..114e425 100644 --- a/rainbowstream/rainbow.py +++ b/rainbowstream/rainbow.py @@ -1950,33 +1950,22 @@ def listen(): # Save cmd to global variable and call process g['stuff'] = ' '.join(line.split()[1:]) # Check tweet length - if check_tweet_length(): - # Process the command - process(cmd)() - # Not re-display - if cmd in ['switch', 't', 'rt', 'rep']: - g['prefix'] = False - else: - g['prefix'] = True + # Process the command + process(cmd)() + # Not re-display + if cmd in ['switch', 't', 'rt', 'rep']: + g['prefix'] = False + else: + g['prefix'] = True # Release the semaphore lock c['lock'] = False except EOFError: printNicely('') + except TwitterHTTPError as e: + detail_twitter_error(e) except Exception: debug_option() - printNicely(red('OMG something is wrong with Twitter right now.')) - - -def check_tweet_length(): - """ - Check tweet length (should be <= 140 chars) - """ - length = len(g['stuff']) - if length <= 140: - return True - - printNicely(red("Message is too long: %s chars" % length)) - return False + printNicely(red('OMG something is wrong with Twitter API right now.')) def reconn_notice(): diff --git a/setup.py b/setup.py index 9a28b1e..74c671d 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import os import os.path # Bumped version -version = '1.2.9' +version = '1.3.0' # Require install_requires = [ -- 2.25.1