feat: Add apify.errors domain-level error taxonomy#990
Draft
vdusek wants to merge 1 commit into
Draft
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces a machine-readable, domain-level error taxonomy in a new
apify.errorsmodule. Each error carries a stablecodeand aretryableflag so automated (agent) callers can branch on a failure without parsing log messages.The module adds
ApifyError(code, retryable)and the typed subclassesActorRunError,ActorTimeoutError,InputValidationError,ChargeLimitExceededError,AuthenticationError, andRateLimitError.ApifyError.from_client_error()mapsapify_client's HTTP-status-based exceptions to these at the SDK boundary, andActorRunError.from_run()derives the right run error from a terminal run status. The names are exported additively fromapify/__init__.py.The change is fully additive: no existing method changes what it raises, and
InputValidationErrorsubclassesValueErrorsoexcept ValueErrorstill catches it. The mapping helpers are available for new code paths (e.g. opt-inraise_on_failure) but are not wired into any existing method.Note:
ActorTimeoutErrorsubclassesActorRunError(rather thanApifyErrordirectly as sketched in the issue) so it reuses therun-based constructor and carries.run_id/.status/.exit_code/.status_message, while still being anApifyError.Closes #988