Source code for pyquickhelper.loghelper.pqh_exception
# -*- coding: utf-8 -*-
"""
logged exception
By default, all exceptions are logged through the function fLOG (:func:`fLOG <pyquickhelper.loghelper.flog.fLOG>`).
::
raise PQHException ("message")
:githublink:`%|py|12`
"""
[docs]class PQHException (Exception):
"""
Define an exception.
- exception used in Python module to make exception
raised by this module easier to catch
- every time exception is logged
:githublink:`%|py|22`
"""
[docs] def __init__(self, m, log=True):
"""
constructor
:param m: message
:param log: log the exception
:githublink:`%|py|28`
"""
Exception.__init__(self, m)
if log:
from .flog import fLOG
fLOG("PQHException", m)