@@ -53,6 +53,16 @@ def toolkit_plugin_bootstrap(
53
53
log_handler , log_file_path = log .get_sgtk_logger (sgtk )
54
54
logger .debug ("Added bootstrap log hander to root logger..." )
55
55
56
+ # Override the global exception hook for catching and reporting uncaught
57
+ # exceptions
58
+ def global_exception_hook (exctype , value , tb ):
59
+ # Log the error with the sgtk logger (e.g. write to tk-alias.log)
60
+ logger .error ("Uncaught Exception" , exc_info = (exctype , value , tb ))
61
+ # Call the python default exception handler
62
+ sys .__excepthook__ (exctype , value , tb )
63
+
64
+ sys .excepthook = global_exception_hook
65
+
56
66
# Toolkit bootstrap may take some time when many bundles need to be
57
67
# downloaded and cached. When not in debug mode, launch a PowerShell
58
68
# window to indicate to the user that the plugin is bootstrapping. At this
@@ -135,6 +145,7 @@ def toolkit_plugin_bootstrap(
135
145
136
146
# Log message to Alias prompt indicating that Flow Production Tracking is ready
137
147
engine .alias_py .log_to_prompt ("Flow Production Tracking initialized" )
148
+
138
149
except Exception as e :
139
150
# There are no specific exceptions that are expected, so catch all and
140
151
# log the error so that the Alias plugin does not crash, or fail
0 commit comments