Coverage for pyquickhelper/loghelper/pqh_exception.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-03 02:21 +0200

1# -*- coding: utf-8 -*- 

2""" 

3@file 

4@brief logged exception 

5 

6By default, all exceptions are logged through the function fLOG (@see fn fLOG). 

7 

8:: 

9 

10 raise PQHException ("message") 

11""" 

12 

13 

14class PQHException (Exception): 

15 

16 """ 

17 Define an exception. 

18 

19 - exception used in Python module to make exception 

20 raised by this module easier to catch 

21 - every time exception is logged 

22 """ 

23 

24 def __init__(self, m, log=True): 

25 """constructor 

26 @param m message 

27 @param log log the exception 

28 """ 

29 Exception.__init__(self, m) 

30 if log: 

31 from .flog import fLOG 

32 fLOG("PQHException", m)