`accouning.calc`: enable crash handlers on `debug_mode` input (via test harness)

qt_w_graceful_SIGINT
Tyler Goodlet 2025-09-29 15:14:35 -04:00
parent 56b660fe34
commit f2ae3b0e2e
1 changed files with 10 additions and 11 deletions

View File

@ -32,6 +32,7 @@ from typing import (
TYPE_CHECKING,
)
from tractor.devx import maybe_open_crash_handler
import polars as pl
from pendulum import (
DateTime,
@ -290,9 +291,7 @@ def iter_by_dt(
# XXX: should never get here..
else:
if debug:
import tractor
with tractor.devx.maybe_open_crash_handler():
with maybe_open_crash_handler(pdb=True):
raise ValueError(
f'Invalid txn time ??\n'
f'txn-id: {k!r}\n'
@ -386,6 +385,7 @@ def open_ledger_dfs(
acctname: str,
ledger: TransactionLedger | None = None,
debug_mode: bool = False,
**kwargs,
@ -400,8 +400,7 @@ def open_ledger_dfs(
can update the ledger on exit.
'''
from piker.toolz import open_crash_handler
with open_crash_handler():
with maybe_open_crash_handler(pdb=debug_mode):
if not ledger:
import time
from ._ledger import open_trade_ledger