Files
browser/bindings/python/lightpanda/errors.py
Adrià Arrufat f4ecf92f3b python: add lightpanda package (sidecar v1)
pip-installable Python API driving the bundled binary over MCP HTTP:
Browser/Session with one generated method per browser tool
(lightpanda/_methods.py, regenerated from tools/list), run_script()
replay, a CLI trampoline entry point, pytest suite against local
fixtures, and pdoc docs generation.
2026-07-23 18:09:21 +02:00

25 lines
759 B
Python

class LightpandaError(Exception):
"""Base error for the lightpanda package."""
class ProtocolError(LightpandaError):
"""JSON-RPC level failure (invalid request, timeout, internal error)."""
def __init__(self, message: str, code: int | None = None):
super().__init__(message)
self.code = code
class ToolError(LightpandaError):
"""A browser tool reported failure (bad selector, JS exception, ...)."""
class ScriptError(LightpandaError):
"""A script replay (`run_script`) exited with a failure."""
def __init__(self, message: str, returncode: int, stdout: str = "", stderr: str = ""):
super().__init__(message)
self.returncode = returncode
self.stdout = stdout
self.stderr = stderr