P2: Simulate engine silently swallows errors #30

Closed
opened 2026-04-09 07:12:12 +02:00 by shoko · 0 comments
Owner

Problem

The simulation engine has silent error handling that makes debugging impossible:

# simulate/engine.py:51-68
try:
    while self.running and datetime.utcnow().timestamp() < end_time:
        try:
            price_data = await self.ave_client.get_token_price(token_id)
            if price_data:
                # ... processing ...
        except Exception as e:
            pass  # SILENTLY SWALLOWS ALL ERRORS!

If the AVE API fails, simulation continues silently with no logging.

Solution

Add proper error logging and user-facing error handling.

Example Approach

import logging
logger = logging.getLogger(__name__)

try:
    price_data = await self.ave_client.get_token_price(token_id)
except Exception as e:
    logger.warning(f"Failed to get price for {token_id}: {e}")
    self.errors.append(f"Price fetch failed for {token_id}: {str(e)}")
    continue

Acceptance Criteria

  • Errors are logged (not silently swallowed)
  • User can see error count/warnings in simulation results
  • Simulation completes even if some price fetches fail (graceful degradation)
## Problem The simulation engine has silent error handling that makes debugging impossible: ```python # simulate/engine.py:51-68 try: while self.running and datetime.utcnow().timestamp() < end_time: try: price_data = await self.ave_client.get_token_price(token_id) if price_data: # ... processing ... except Exception as e: pass # SILENTLY SWALLOWS ALL ERRORS! ``` If the AVE API fails, simulation continues silently with no logging. ## Solution Add proper error logging and user-facing error handling. ### Example Approach ```python import logging logger = logging.getLogger(__name__) try: price_data = await self.ave_client.get_token_price(token_id) except Exception as e: logger.warning(f"Failed to get price for {token_id}: {e}") self.errors.append(f"Price fetch failed for {token_id}: {str(e)}") continue ``` ## Acceptance Criteria - [ ] Errors are logged (not silently swallowed) - [ ] User can see error count/warnings in simulation results - [ ] Simulation completes even if some price fetches fail (graceful degradation)
shoko closed this issue 2026-04-09 12:19:36 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/randebu#30