reydb 1.1.30__py3-none-any.whl → 1.1.32__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
reydb/rlog.py CHANGED
@@ -13,7 +13,7 @@ from typing import Any
13
13
  from collections.abc import Callable
14
14
  from traceback import StackSummary
15
15
  from functools import wraps as functools_wraps
16
- from reykit.rbase import T, throw, catch_exc
16
+ from reykit.rbase import T, Exit, throw, catch_exc
17
17
 
18
18
  from .rbase import DatabaseBase
19
19
  from .rconn import DatabaseConnection
@@ -232,15 +232,17 @@ class DatabaseLog(DatabaseBase):
232
232
  self,
233
233
  func: Callable[..., T] | None = None,
234
234
  *,
235
- note: str | None = None
235
+ note: str | None = None,
236
+ filter_exc : BaseException | tuple[BaseException, ...] = Exit
236
237
  ) -> T | Callable[[Callable[..., T]], Callable[..., T]]:
237
238
  """
238
- Decorator, insert exception information into the table of database.
239
+ Decorator, insert exception information into the table of database, throw exception.
239
240
 
240
241
  Parameters
241
242
  ----------
242
243
  func : Function.
243
244
  note : Exception note.
245
+ filter_exc : Exception type of not inserted, but still throw exception.
244
246
 
245
247
  Returns
246
248
  -------
@@ -268,6 +270,10 @@ class DatabaseLog(DatabaseBase):
268
270
  >>> func(*args, **kwargs)
269
271
  """
270
272
 
273
+ # Handle parameter.
274
+ if issubclass(filter_exc, BaseException):
275
+ filter_exc = (filter_exc,)
276
+
271
277
 
272
278
  def _wrap(func_: Callable[..., T]) -> Callable[..., T]:
273
279
  """
@@ -305,7 +311,11 @@ class DatabaseLog(DatabaseBase):
305
311
  # Log.
306
312
  except BaseException:
307
313
  _, exc, stack = catch_exc()
308
- self.error(exc, stack, note)
314
+
315
+ ## Filter.
316
+ if type(exc) not in filter_exc:
317
+ self.error(exc, stack, note)
318
+
309
319
  raise
310
320
 
311
321
  return result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reydb
3
- Version: 1.1.30
3
+ Version: 1.1.32
4
4
  Summary: Database method set.
5
5
  Project-URL: homepage, https://github.com/reyxbo/reydb/
6
6
  Author-email: Rey <reyxbo@163.com>
@@ -7,9 +7,9 @@ reydb/rdb.py,sha256=hjWwB778jxBoTgx2lgs6n1NZMJA0Hbg4HHdXE57hZiY,61841
7
7
  reydb/rexec.py,sha256=dGdRkG1XR0Z66T0r4nPCSdQzSRWc_Q3t6TPSSrDTIxY,9042
8
8
  reydb/rfile.py,sha256=7g6hPBz33p-mkGFc6LEmL2hpFes-LM-AWQ0SxgJe2BI,15254
9
9
  reydb/rinfo.py,sha256=KXTkcpTGAD3p9RVKKcnmc_FjJtiKRPk-K5ZepPOnphQ,15253
10
- reydb/rlog.py,sha256=kwwdOV3RODlfw4u8yzSX6oyh0o5pDXAdDGbogNdx5ds,9412
10
+ reydb/rlog.py,sha256=ckdxNTUmpYEyETOoTTk6BeK7_ZlFnWzRD8BevaRfkn8,9803
11
11
  reydb/rparam.py,sha256=3BGDBD8QshOf2J70ZJ6LJ9PiH-1ZU3ruZwoE0bN6OOw,7017
12
- reydb-1.1.30.dist-info/METADATA,sha256=_OlavbtH-_7gy5zv7VSwLh1ObfaKMmpHdnx5N_ZR_H4,1550
13
- reydb-1.1.30.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
- reydb-1.1.30.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
15
- reydb-1.1.30.dist-info/RECORD,,
12
+ reydb-1.1.32.dist-info/METADATA,sha256=CcgVFLdAR7PmtZjbqpBv4X_IP_dSF7RkORhUCD4GjkU,1550
13
+ reydb-1.1.32.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
+ reydb-1.1.32.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
15
+ reydb-1.1.32.dist-info/RECORD,,
File without changes