Permalink
Browse files

Added logging of exceptions from r21buddy console code to r21buddy GUI.

  • Loading branch information...
Vultaire committed Jun 10, 2012
1 parent ad574f1 commit f334873d595c145cc2c4d88796187a15ebf8a703
Showing with 16 additions and 13 deletions.
  1. +16 −13 r21buddy/r21buddy.py
View
@@ -6,7 +6,7 @@
from __future__ import absolute_import
-import os, sys, argparse, shutil
+import os, sys, argparse, shutil, traceback
from r21buddy import oggpatch
from r21buddy.logger import logger
@@ -107,18 +107,21 @@ def patch_length(target_dir, verbose=False):
def run(target_dir, input_paths, length_patch=True, verbose=False, ext_logger=None):
global logger
- if logger is not None:
- logger = ext_logger
- oggpatch.set_logger(logger)
- create_target_dir_structure(target_dir, verbose=verbose)
-
- for input_path in input_paths:
- copy_songs(input_path, target_dir, verbose=verbose)
-
- # *NOTE:* If no input paths are specified, this tool can be used
- # to patch the length on existing ogg files in the target dir.
- if length_patch:
- patch_length(target_dir, verbose=verbose)
+ try:
+ if logger is not None:
+ logger = ext_logger
+ oggpatch.set_logger(logger)
+ create_target_dir_structure(target_dir, verbose=verbose)
+
+ for input_path in input_paths:
+ copy_songs(input_path, target_dir, verbose=verbose)
+
+ # *NOTE:* If no input paths are specified, this tool can be used
+ # to patch the length on existing ogg files in the target dir.
+ if length_patch:
+ patch_length(target_dir, verbose=verbose)
+ except:
+ logger.error(traceback.format_exc())
def main():
options = parse_args()

0 comments on commit f334873

Please sign in to comment.