#4142·crawlee

`IBrowserPool.closePage`: say what `error` actually means

Author: janbucharCreated Sep 18, 2026Updated Sep 22, 2026
Labelst-tooling
  • BrowserCrawler passes SessionError('Session is no longer usable') to closePage() whenever session.isUsable() is false — which includes routine maxUsageCount / maxAgeSecs expiry, not just a block. The built-in BrowserPool retiring 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 SessionError as "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 plain SessionError for a block. Signature unchanged, existing instanceof SessionError handling 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.