aqt.errors
==========

.. py:module:: aqt.errors


Classes
-------

.. autoapisummary::

   aqt.errors.ErrorHandler


Functions
---------

.. autoapisummary::

   aqt.errors.show_exception
   aqt.errors.is_chromium_cert_error
   aqt.errors.excepthook
   aqt.errors.addon_fmt
   aqt.errors.addon_debug_info


Module Contents
---------------

.. py:function:: show_exception(*, parent: QWidget, exception: Exception) -> None

   Present a caught exception to the user using a pop-up.


.. py:function:: is_chromium_cert_error(error: str) -> bool

   QtWebEngine sometimes spits out 'unknown error' messages to stderr on Windows.

   They appear to be IDS_SETTINGS_CERTIFICATE_MANAGER_UNKNOWN_ERROR in
   chrome/browser/ui/webui/certificates_handler.cc. At a guess, it's the
   NetErrorToString() method.

   The constant appears to get converted to an ID; the resources are found
   in files like this:

   chrome/app/resources/generated_resources_fr-CA.xtb
   2258:<translation id="3380365263193509176">Erreur inconnue</translation>

   List derived with:
   qtwebengine-chromium% rg --no-heading --no-filename --no-line-number         3380365263193509176  | perl -pe 's/.*>(.*)<.*/"$1",/' | sort | uniq
       
   This list has been manually updated to add a different Japanese translation, as
   the translations may change in different Chromium releases.

   Judging by error reports, we can't assume the error falls on a separate line:
   https://forums.ankiweb.net/t/topic/22036/


.. py:function:: excepthook(etype, val, tb) -> None

.. py:class:: ErrorHandler(mw: aqt.main.AnkiQt)

   Bases: :py:obj:`QObject`


   Catch stderr and write into buffer.


   .. py:attribute:: ivl
      :value: 100



   .. py:attribute:: fatal_error_encountered
      :value: False



   .. py:attribute:: errorTimer


   .. py:attribute:: mw


   .. py:attribute:: timer
      :type:  QTimer | None
      :value: None



   .. py:attribute:: pool
      :value: ''



   .. py:method:: unload() -> None


   .. py:method:: write(data: str) -> None


   .. py:method:: setTimer() -> None


   .. py:method:: tempFolderMsg() -> str


   .. py:method:: onTimeout() -> None


.. py:function:: addon_fmt(addmgr: aqt.addons.AddonManager, addon: aqt.addons.AddonMeta) -> str

.. py:function:: addon_debug_info() -> str

