Skip to content

Commit

Permalink
refactor: pass exception object to log_env_details
Browse files Browse the repository at this point in the history
  • Loading branch information
fariss committed Apr 29, 2024
1 parent 46f45fd commit b2a99cc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion data/python/jepeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ def _jepeval(line):
import jeputils

traceback.print_exc()
jeputils.log_env_details(type(err))
jeputils.log_env_details(err)

return more_input_needed
2 changes: 1 addition & 1 deletion data/python/jeprunscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ def jep_runscript(path):
import jeputils

traceback.print_exc()
jeputils.log_env_details(type(err))
jeputils.log_env_details(err)
7 changes: 4 additions & 3 deletions data/python/jeputils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
import ghidrathon
from java.lang import System

ALLOWED_EXCEPTIONS = [RuntimeError, OSError]
ALLOWED_EXCEPTIONS = (RuntimeError, OSError)


def log_env_details(exc_type):
if any(issubclass(exc_type, exc_class) for exc_class in ALLOWED_EXCEPTIONS):
def log_env_details(exc):
exc_type = type(exc)
if issubclass(exc_type, ALLOWED_EXCEPTIONS):
print(
f"Python={platform.python_version()}, "
f"Arch={System.getProperty('os.arch')}, "
Expand Down

0 comments on commit b2a99cc

Please sign in to comment.