`accouning.calc`: enable crash handlers on `debug_mode` input (via test harness)
							parent
							
								
									56b660fe34
								
							
						
					
					
						commit
						f2ae3b0e2e
					
				|  | @ -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,15 +291,13 @@ def iter_by_dt( | |||
| 
 | ||||
|         # XXX: should never get here.. | ||||
|         else: | ||||
|             if debug: | ||||
|                 import tractor | ||||
|                 with tractor.devx.maybe_open_crash_handler(): | ||||
|                     raise ValueError( | ||||
|                         f'Invalid txn time ??\n' | ||||
|                         f'txn-id: {k!r}\n' | ||||
|                         f'{k!r}: {v!r}\n' | ||||
|                     ) | ||||
|                         # assert v is not None, f'No valid value for `{k}`!?' | ||||
|             with maybe_open_crash_handler(pdb=True): | ||||
|                 raise ValueError( | ||||
|                     f'Invalid txn time ??\n' | ||||
|                     f'txn-id: {k!r}\n' | ||||
|                     f'{k!r}: {v!r}\n' | ||||
|                 ) | ||||
|                     # assert v is not None, f'No valid value for `{k}`!?' | ||||
| 
 | ||||
|             if _invalid is not None: | ||||
|                 _invalid.append(tx) | ||||
|  | @ -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 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue