okami.mom/albedo
git clone https://git.nkp.pet/okami.mom/albedo
7de30f7
main
1"""Errors expose data rather than requiring agents to parse exception prose.""" 2 3from __future__import annotations 4 5from typing import Any 6 7 8class BrowserError (Exception ): 9kind = "browser_error" 10 11def __init__ (self ,message :str ,** details :Any )-> None : 12super ().__init__ (message ) 13self .details = details 14 15def to_dict (self )-> dict [str ,Any ]: 16return {"kind" :self .kind ,"message" :str (self ),** self .details } 17 18 19class ConnectionLost (BrowserError ): 20kind = "connection_lost" 21 22 23class CommandTimeout (BrowserError ): 24kind = "command_timeout" 25 26 27class ProtocolError (BrowserError ): 28kind = "protocol_error" 29 30 31class EventOverflow (BrowserError ): 32kind = "event_overflow" 33 34 35class WaitTimeout (BrowserError ): 36kind = "wait_timeout" 37 38 39class SelectionError (BrowserError ): 40kind = "selection_error" 41 42 43class StaleReference (BrowserError ): 44kind = "stale_reference" 45 46 47class NotActionable (BrowserError ): 48kind = "not_actionable" 49 50 51class ActionOutcomeUnknown (BrowserError ): 52kind = "action_outcome_unknown" 53 54 55class JavaScriptError (BrowserError ): 56kind = "javascript_error" 57 58 59class UnsupportedOperation (BrowserError ): 60kind = "unsupported_operation" 61 62 63class IncompleteObservation (BrowserError ): 64kind = "incomplete_observation" 65 66 67class LaunchError (BrowserError ): 68kind = "launch_error" 69 70 71class TargetGone (BrowserError ): 72kind = "target_gone" 73 74 75class RecoveryError (BrowserError ): 76kind = "recovery_error"