`IBrowserPool.closePage`: say what `error` actually means
Author: janbucharCreated Sep 18, 2026Updated Sep 22, 2026
Labelst-tooling
BrowserCrawlerpassesSessionError('Session is no longer usable')toclosePage()wheneversession.isUsable()is false — which includes routinemaxUsageCount/maxAgeSecsexpiry, not just a block. The built-inBrowserPoolretiring the browser on it is correct: a finished session's browser state is garbage.- The JSDoc reads differently ("when a session has gone bad", "released because of an error"), so an implementation that keeps a page across requests and treats
SessionErroras "blocked" gets its page dropped after 50 requests. - Minimum fix: reword before the interface freezes —
error instanceof SessionError⇒ the session is finished for any reason; discard whatever browser state was tied to it. - Better: the crawler throws a subclass for the peaceful case —
SessionRetiredError extends SessionError(usage count / age exhausted) versus a plainSessionErrorfor a block. Signature unchanged, existinginstanceof SessionErrorhandling keeps retiring browsers, and a pool that wants to keep a warm page across usage-count rotation can check the subclass first. Additive, so it could even follow 4.0; the wording fix should not.
Source: apify/crawlee