wait_for_finish() on runs and builds returns None when the job is still missing after the 3 s not-found window, or when the deadline passes while the API keeps returning 404 (_resource_clients/_resource_client.py:360-369). actor.call() and task.call() pass that None on. So RunClient.wait_for_finish, BuildClient.wait_for_finish, call() and their async twins are typed Run | None / Build | None, and every caller has to check for None.
The JS client throws in the same situation: it rethrows the API's 404 as a NotFoundError (Actor run was not found, type record-not-found), so its return types are plain ActorRun / Build (apify/apify-client-js#1124).
Expected behavior
Raise NotFoundError when the job can't be found, as the JS client does, and narrow the return types to Run / Build. This changes the return type and turns a None into an exception, so it needs a major release.
✍️ Drafted by Claude Code
wait_for_finish()on runs and builds returnsNonewhen the job is still missing after the 3 s not-found window, or when the deadline passes while the API keeps returning 404 (_resource_clients/_resource_client.py:360-369).actor.call()andtask.call()pass thatNoneon. SoRunClient.wait_for_finish,BuildClient.wait_for_finish,call()and their async twins are typedRun | None/Build | None, and every caller has to check forNone.The JS client throws in the same situation: it rethrows the API's 404 as a
NotFoundError(Actor run was not found, typerecord-not-found), so its return types are plainActorRun/Build(apify/apify-client-js#1124).Expected behavior
Raise
NotFoundErrorwhen the job can't be found, as the JS client does, and narrow the return types toRun/Build. This changes the return type and turns aNoneinto an exception, so it needs a major release.✍️ Drafted by Claude Code