Skip to content

feat: Add apify.errors domain-level error taxonomy#990

Draft
vdusek wants to merge 1 commit into
masterfrom
feat/error-taxonomy
Draft

feat: Add apify.errors domain-level error taxonomy#990
vdusek wants to merge 1 commit into
masterfrom
feat/error-taxonomy

Conversation

@vdusek

@vdusek vdusek commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Introduces a machine-readable, domain-level error taxonomy in a new apify.errors module. Each error carries a stable code and a retryable flag so automated (agent) callers can branch on a failure without parsing log messages.

The module adds ApifyError(code, retryable) and the typed subclasses ActorRunError, ActorTimeoutError, InputValidationError, ChargeLimitExceededError, AuthenticationError, and RateLimitError. ApifyError.from_client_error() maps apify_client's HTTP-status-based exceptions to these at the SDK boundary, and ActorRunError.from_run() derives the right run error from a terminal run status. The names are exported additively from apify/__init__.py.

The change is fully additive: no existing method changes what it raises, and InputValidationError subclasses ValueError so except ValueError still catches it. The mapping helpers are available for new code paths (e.g. opt-in raise_on_failure) but are not wired into any existing method.

Note: ActorTimeoutError subclasses ActorRunError (rather than ApifyError directly as sketched in the issue) so it reuses the run-based constructor and carries .run_id/.status/.exit_code/.status_message, while still being an ApifyError.

Closes #988

@vdusek vdusek added the t-tooling Issues with this label are in the ownership of the tooling team. label Jun 16, 2026
@vdusek vdusek self-assigned this Jun 16, 2026
@github-actions github-actions Bot added this to the 143rd sprint - Tooling team milestone Jun 16, 2026
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label Jun 16, 2026
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.51%. Comparing base (e8cda0a) to head (082f090).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #990      +/-   ##
==========================================
+ Coverage   90.35%   90.51%   +0.16%     
==========================================
  Files          49       50       +1     
  Lines        3089     3153      +64     
==========================================
+ Hits         2791     2854      +63     
- Misses        298      299       +1     
Flag Coverage Δ
e2e 36.72% <60.93%> (+0.50%) ⬆️
integration 57.50% <60.93%> (+0.03%) ⬆️
unit 79.35% <100.00%> (+0.42%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add apify.errors: domain-level error taxonomy over apify-client exceptions

2 participants