Browse Source

refactor error message

Arnau Sanchez 9 years ago
parent
commit
a381840c70
2 changed files with 10 additions and 4 deletions
  1. 9 3
      youtube_upload/lib.py
  2. 1 1
      youtube_upload/main.py

+ 9 - 3
youtube_upload/lib.py

@@ -76,7 +76,13 @@ def retriable_exceptions(fun, retriable_exceptions, max_retries=None):
                 raise exc
             else:
                 seconds = random.uniform(0, 2**retry)
-                debug("[Retryable error {0}/{1}] {2}: {3}. Waiting {4} seconds".
-                    format(retry, max_retries or "-", 
-                    type(exc).__name__, exc, "%.1f" % seconds))
+                message = ("[Retryable error {current_retry}/{total_retries}] " +
+                    "{error_type} ({error_msg}). Wait {wait_time} seconds").format(
+                    current_retry=retry, 
+                    total_retries=max_retries or "-", 
+                    error_type=type(exc).__name__, 
+                    error_msg=str(exc) or "-", 
+                    wait_time="%.1f" % seconds,
+                )
+                debug(message)
                 time.sleep(seconds)

+ 1 - 1
youtube_upload/main.py

@@ -178,7 +178,7 @@ def main(arguments):
     parser.add_option('', '--client-secrets', dest='client_secrets',
         type="string", help='Client secrets JSON file')
     parser.add_option('', '--credentials-file', dest='credentials_file',
-        type="string", help='Client secrets JSON file')
+        type="string", help='Credentials JSON file')
     parser.add_option('', '--auth-browser', dest='auth_browser', action="store_true",
         help='Open a GUI browser to authenticate if required')