Skip to content

Add the request URL to ApifyApiError and improve the message for an empty error body #1177

Description

@vdusek

ApifyApiError exposes message, type, status_code, attempt, http_method and data (errors.py#L55-L79). It has no URL or path, so a log line such as NotFoundError: Actor was not found does not say which request failed. The raising code knows the URL (_base.py#L680).

When the body has no error object, the message is f'Unexpected error: {response.text}' (#L65). For an empty body, such as a bare 502 from a proxy, that is just Unexpected error: , with no status code.

The JS ApifyApiError has path (pathname plus query), clientMethod and originalStack, and prints them in its stack (apify_api_error.ts#L43-L138).

Expected behavior

ApifyApiError gets a url (or path) attribute, with any token in the query string removed, and includes the method and path in str(exc). When the body carries no error message, the message names the status code, for example Unexpected error (HTTP 502): <body>, and drops the body part when it is empty.

✍️ Drafted by Claude Code

Activity

  1. added
    enhancementNew feature or request.
    t-toolingIssues with this label are in the ownership of the tooling team.
    on Oct 30, 2026
  2. added theissue type on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-toolingIssues with this label are in the ownership of the tooling team.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions