(*args, **kwargs)
| 383 | |
| 384 | def error_handler(func): |
| 385 | def wrapper(*args, **kwargs): |
| 386 | onerror = kwargs.get("onerror") |
| 387 | result = {} |
| 388 | |
| 389 | try: |
| 390 | vals = func(*args, **kwargs) |
| 391 | if vals: |
| 392 | result["data"] = vals |
| 393 | except Exception as e: # noqa: BLE001 |
| 394 | if onerror is not None: |
| 395 | onerror(result, e, **kwargs) |
| 396 | return result |
| 397 | |
| 398 | return wrapper |
| 399 |