Fixes tryexceptpass for helpers and panel handler.

This commit is contained in:
Andrew 2021-11-17 17:23:14 -05:00
parent b92b9c04fb
commit aeb6b774f4
3 changed files with 12 additions and 13 deletions

View File

@ -209,8 +209,8 @@ class Helpers:
if r.status_code in [200, 201]:
try:
data = json.loads(r.content)
except:
pass
except Exception as e:
logger.error("Failed to load json content with error: {} ".format(e))
return data
@ -377,7 +377,7 @@ class Helpers:
try:
os.makedirs(os.path.join(self.root_dir, 'logs'))
except Exception as e:
pass
console.error("Failed to make logs directory with error: {} ".format(e))
# ensure the log file is there
try:
@ -389,8 +389,8 @@ class Helpers:
# del any old session.lock file as this is a new session
try:
os.remove(session_log_file)
except:
pass
except Exception as e:
logger.error("Deleting Session.lock failed with error: {} ".format(e))
@staticmethod
def get_time_as_string():
@ -461,7 +461,9 @@ class Helpers:
started = data.get('started')
console.critical("Another Crafty Controller agent seems to be running...\npid: {} \nstarted on: {}".format(pid, started))
except Exception as e:
pass
logger.error("Failed to locate existing session.lock with error: {} ".format(e))
console.error("Failed to locate existing session.lock with error: {} ".format(e))
sys.exit(1)

View File

@ -150,8 +150,8 @@ class PanelHandler(BaseHandler):
try:
data = json.loads(s['int_ping_results'])
s['int_ping_results'] = data
except:
pass
except Exception as e:
logger.error("Failed server data for page with error: {} ".format(e))
template = "panel/dashboard.html"

View File

@ -170,11 +170,8 @@ class ServerHandler(BaseHandler):
server_parts = server.split("|")
captured_roles = []
for role in user_roles:
try:
if bleach.clean(self.get_argument(str(role), '')) == "on":
captured_roles.append(role)
except:
pass
if bleach.clean(self.get_argument(str(role), '')) == "on":
captured_roles.append(role)
if not server_name:
self.redirect("/panel/error?error=Server name cannot be empty!")