devctrl.utility.messaging.exception.show_exception#

show_exception(message: str, ex: Exception, logger: Logger | None = None, level: Literal['warning', 'error'] = 'error', title: str | None = None, typ: str | None = None, do_log: bool = True, show_traceback: bool = True, force_print: bool = False)[source]#

Show an error message with information from an exception.

It is assumed that the logger prints messages as well. If do_log is set, only the logger is used and the message is not printed to stdout. To force printing, pass force_print=True, however, this is incompatible with the GUI version.

Parameters:
  • message – A context message.

  • ex – The exception.

  • logger – The logger, defaults to this module’s logger.

  • level – Log level to use.

  • title – Not used in non-GUI version.

  • typ – Message type for suppressing repeated messages. Defaults to the message itself.

  • do_log – Whether to log the message.

  • show_traceback – Whether to include the traceback in the log and the dialog.

  • force_print – Whether to print the message even when a do_log is True.