Skip to content

Commit

Permalink
Better exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Mar 12, 2019
1 parent 4ec1acb commit b02d89f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/admin_scripts/base/encoding.py
Expand Up @@ -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
Expand Down Expand Up @@ -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)" %\
(
Expand Down
2 changes: 1 addition & 1 deletion src/admin_scripts/base/jssource.py
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion src/admin_scripts/base/pysource.py
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/admin_scripts/extra/shell.py
Expand Up @@ -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.