Skip to content

ref(errors)!: raise ArgumentError for bad arguments and fix misleading error messages - #729

Merged
route merged 1 commit into
mainfrom
ref/error-messages
Nov 24, 2026
Merged

route merged 1 commit into
mainfrom
ref/error-messages

Conversation

@route

@route route commented Nov 24, 2026

Copy link
Copy Markdown
Member

Part of #557, "Update error messages".

Error classes (breaking)

  • ArgumentError instead of RuntimeError: an unknown mouse button, cookies.remove without :domain or :url, a relative go_to without :base_url.
  • ArgumentError instead of Ferrum::Error: a relative :save_path.
  • Ferrum::Error instead of RuntimeError: a failed screencast, debug_url when the browser lists no page.
  • Browser::Options::BASE_URL_SCHEMA is renamed to BASE_URL_SCHEMES.

Messages

  • NoSuchPageError names the command and the target id, attach_target's NoSuchTargetError names the target and the context.
  • CoordinatesNotFoundError keeps Chrome's text, EmptyPathError gets a default message.
  • ArgumentErrors that had no text (frame.state=, downloads.set_behavior) list the valid values, the keyboard's "unexpected argument" says what was passed.
  • DeadBrowserError no longer mentions windows, NodeMovingError no longer assumes a click, TimeoutError is one line.
  • Raw array inspects become :a | :b lists, RGBA and :background_color messages read as sentences, the PDF :format message says the options exclude each other.
  • Links point to docs.rubycdp.com instead of old README anchors.

Messages that were already clear keep their text, some are only capitalized.

…g error messages

Bare RuntimeError raises (unknown mouse button, cookies.remove without :domain or :url, relative go_to without
:base_url) become ArgumentError, a relative :save_path raises ArgumentError instead of Ferrum::Error, and
screencast and debug_url failures raise Ferrum::Error.

NoSuchPageError, NoSuchTargetError, EmptyPathError, CoordinatesNotFoundError and ArgumentErrors without text now
name what's missing or list the valid values. DeadBrowserError no longer talks about windows, NodeMovingError no
longer assumes a click, TimeoutError is one line, raw array inspects become a | b lists, and links point to
docs.rubycdp.com.

Refs #557
@route
route merged commit eb76d48 into main Nov 24, 2026
11 of 12 checks passed
@route
route deleted the ref/error-messages branch November 24, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant