Skip to content
Permalink
Browse files

Better exception handling

  • Loading branch information...
joamag committed Mar 12, 2019
1 parent 4ec1acb commit b02d89fbb9bade1d4cbf5c4145b751cd41912741
@@ -78,7 +78,7 @@ def has_encoding(string_buffer, encoding):
# setting the has encoding flag to valid in case nothing fails
string_buffer.decode(encoding)
has_encoding = True
except:
except Exception:
# sets the has encoding flag as false as there was an error while
# trying to decode the buffer with the requested encoding
has_encoding = False
@@ -246,7 +246,7 @@ def convert_encoding_walker(arguments, directory_name, names):
windows_newline,
replacements_list
)
except:
except Exception:
extra.warn(
"Failed converting encoding in file: %s (%s to %s)" %\
(
@@ -66,7 +66,7 @@ def jssource_file(file_path, beautifty = True, encoding = "utf-8"):
"""

try: import jsbeautifier
except: jsbeautifier = None
except ImportError: jsbeautifier = None

is_min = file_path.endswith("min.js")

@@ -66,7 +66,7 @@ def pysource_file(file_path, run_pep8 = True, ignores = ()):
"""

try: import pep8
except: pep8 = None
except ImportError: pep8 = None

if pep8:
class ErrorReport(pep8.StandardReport):
@@ -44,6 +44,6 @@ def shell_exec(command, args, tester = None, shell = True):
if tester:
null = open(os.devnull, "wb")
try: result = subprocess.call(tester, stdout = null, stderr = null, shell = shell)
except: return
except Exception: return
if result: return
subprocess.call([command] + args, shell = shell)

0 comments on commit b02d89f

Please sign in to comment.
You can’t perform that action at this time.