reydb 1.1.29__py3-none-any.whl → 1.1.31__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
@@ -232,21 +232,48 @@ 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, ...] = None
|
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
|
-------
|
247
249
|
Decorated function or decorator with parameter.
|
250
|
+
|
251
|
+
Examples
|
252
|
+
--------
|
253
|
+
Method one.
|
254
|
+
>>> @wrap_error
|
255
|
+
>>> def func(*args, **kwargs): ...
|
256
|
+
|
257
|
+
Method two.
|
258
|
+
>>> @wrap_error(**wrap_kwargs)
|
259
|
+
>>> def func(*args, **kwargs): ...
|
260
|
+
|
261
|
+
Method three.
|
262
|
+
>>> def func(*args, **kwargs): ...
|
263
|
+
>>> func = wrap_error(func, **wrap_kwargs)
|
264
|
+
|
265
|
+
Method four.
|
266
|
+
>>> def func(*args, **kwargs): ...
|
267
|
+
>>> wrap_error = wrap_error(**wrap_kwargs)
|
268
|
+
>>> func = wrap_error(func)
|
269
|
+
|
270
|
+
>>> func(*args, **kwargs)
|
248
271
|
"""
|
249
272
|
|
273
|
+
# Handle parameter.
|
274
|
+
if issubclass(filter_exc, BaseException):
|
275
|
+
filter_exc = (filter_exc,)
|
276
|
+
|
250
277
|
|
251
278
|
def _wrap(func_: Callable[..., T]) -> Callable[..., T]:
|
252
279
|
"""
|
@@ -284,7 +311,11 @@ class DatabaseLog(DatabaseBase):
|
|
284
311
|
# Log.
|
285
312
|
except BaseException:
|
286
313
|
_, exc, stack = catch_exc()
|
287
|
-
|
314
|
+
|
315
|
+
## Filter.
|
316
|
+
if type(exc) not in filter_exc:
|
317
|
+
self.error(exc, stack, note)
|
318
|
+
|
288
319
|
raise
|
289
320
|
|
290
321
|
return result
|
@@ -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=
|
10
|
+
reydb/rlog.py,sha256=uB7k_JBTxDPzas9cmsR3-nmjFBq7l3N4xEEbACj73i4,9797
|
11
11
|
reydb/rparam.py,sha256=3BGDBD8QshOf2J70ZJ6LJ9PiH-1ZU3ruZwoE0bN6OOw,7017
|
12
|
-
reydb-1.1.
|
13
|
-
reydb-1.1.
|
14
|
-
reydb-1.1.
|
15
|
-
reydb-1.1.
|
12
|
+
reydb-1.1.31.dist-info/METADATA,sha256=RAnCVfzN3wJjpC9kG5n5R2i809DxqslcFvAhTBryJjc,1550
|
13
|
+
reydb-1.1.31.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
14
|
+
reydb-1.1.31.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
15
|
+
reydb-1.1.31.dist-info/RECORD,,
|
File without changes
|
File without changes
|