Skip to content

Commit

Permalink
Add exception reporting for context menu callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward J Schwartz committed Feb 23, 2024
1 parent 47338cd commit 988d43a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libbs/decompilers/ghidra/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,13 @@ def gui_plugin(self, value):
pass

def gui_register_ctx_menu(self, name, action_string, callback_func, category=None) -> bool:
ctx_menu_action = create_context_action(self.ghidra, name, action_string, callback_func, category or "LibBS")
def callback_func_wrap(*args, **kwargs):
try:
callback_func(*args, **kwargs)
except Exception as e:
self.warning(f"Exception in ctx menu callback {name}: {e}")
raise
ctx_menu_action = create_context_action(self.ghidra, name, action_string, callback_func_wrap, category or "LibBS")
self.ghidra.getState().getTool().addAction(ctx_menu_action)
return True

Expand Down

0 comments on commit 988d43a

Please sign in to comment.