Skip to content

fix: improve error messages and exception handling in sec_utils.py#83

Open
sjhddh wants to merge 1 commit intoAI4Finance-Foundation:masterfrom
sjhddh:fix/sec-utils-dynamic-year
Open

fix: improve error messages and exception handling in sec_utils.py#83
sjhddh wants to merge 1 commit intoAI4Finance-Foundation:masterfrom
sjhddh:fix/sec-utils-dynamic-year

Conversation

@sjhddh
Copy link

@sjhddh sjhddh commented Jan 25, 2026

Summary

Improve error handling and messages in SECUtils.download_10k_filing() and SECUtils.download_10k_pdf().

Changes

  1. Replace hardcoded year in error messages

    • Before: "No 2023 10-K filing found for {ticker}"
    • After: "No 10-K filing found for {ticker} between {start_date} and {end_date}"
  2. Improve exception handling

    • Replace bare except: with except Exception as e: to capture and display the actual error
  3. Fix typo

    • "downloaded failed" -> "download failed"
  4. Consistent formatting

    • Use hyphen separator for error details: {url} - {e}

Test plan

  • Verify error messages now show the actual search date range
  • Verify exception details are included in error output
  • No functional changes to success paths

- Replace hardcoded "2023" with actual search date range in error messages
- Replace bare `except:` with `except Exception as e:` for better debugging
- Fix typo "downloaded" -> "download" in error messages
- Use consistent error message format with hyphen separator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant