A class for catching and logging exceptions to a file on the system.
Automatically catch exceptions thrown by the decorated function, log them to a file, and notify the player about the exception.
Decorate functions with this decorator to catch and log exceptions
- mod_identifier (Union[str, CommonModIdentity]) – The name or identity of the mod catching exceptions.
- fallback_return (Any, optional) – A value to return upon an exception being caught. Default is None.
A function wrapped to catch and log exceptions.
log_exception(mod_identifier, exception_message, exception=None, custom_file_path=None)¶
Manually log an exception with a custom message.
- mod_identifier (Union[str, CommonModIdentity]) – The name or identity of the mod logging the exception.
- exception_message (str) – A message to provide more information about the exception.
- exception (Exception, optional) – The exception being logged. Default is None.
- custom_file_path (str, optional) – A custom file path relative to The Sims 4 folder. Example: Value is ‘fake_path/to/directory’, the final path would be ‘The Sims 4/fake_path/to_directory’. Default is None.
True, if the message was successfully logged. False, if the message was not successfully logged.
Utilities for accessing the full stack trace of your application.
current_stack(skip: int = 0) → Any¶
Retrieve the current stack
Parameters: skip – The number of lines to skip Returns: A collection of the current stack.
full_exception_info() → Union[type, Any, sims4communitylib.exceptions.common_stacktrace_utils.FullTraceback]¶
Like sys.exc_info, but includes the full traceback.
get_full_stack_trace() → List[str]¶
Retrieve the full stacktrace from the current stack.
Returns: A collection of stack trace strings.