Files
wehub-resource-sync 4b6817381b
Benchmark image — build + push to ECR (any adapter) / build + push (push) Waiting to run
CI / quality (ubuntu-latest) (push) Waiting to run
CI / test (tools-runtime) (push) Waiting to run
CI / test (e2e-general) (push) Waiting to run
CI / test (cli-runtime) (push) Waiting to run
CI / test (e2e-provider-and-openclaw) (push) Waiting to run
CI / test (integrations-and-misc) (push) Waiting to run
CI / coverage-report (push) Blocked by required conditions
CI / test-kubernetes (push) Waiting to run
CI / should-run-thorough (push) Waiting to run
CI / test-thorough (cloudwatch-demo) (push) Blocked by required conditions
CI / test-thorough (flink-ecs) (push) Blocked by required conditions
CI / test-thorough (upstream-lambda) (push) Blocked by required conditions
CI / test-thorough (prefect-ecs-fargate) (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Blocked by required conditions
Release / publish-release (push) Blocked by required conditions
Release / publish-main-release (push) Blocked by required conditions
Release / prepare (push) Waiting to run
Release / verify (push) Blocked by required conditions
Release / build-python-dist (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Blocked by required conditions
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Waiting to run
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:10:45 +08:00

41 lines
1.4 KiB
Python

"""Structured, frontend-agnostic error for opensre.
Carries a human-readable suggestion (what to do next) and an optional docs
link, following the `clig.dev <https://clig.dev/>`_ / flyctl convention. Lives
in ``platform/common`` so any layer (CLI, tools, integrations, infra) can raise
and catch the same error contract without importing the CLI package.
Rendering is a CLI concern: ``interactive_shell.utils.error_handling.errors``
defines a ``click.ClickException`` subclass so CLI-raised errors render through
Click's existing path, and ``cli.__main__`` renders base errors raised by
non-CLI code. Catch this base type to handle both.
"""
from __future__ import annotations
class OpenSREError(Exception):
"""A structured error carrying an optional suggestion and docs URL."""
def __init__(
self,
message: str,
*,
suggestion: str | None = None,
docs_url: str | None = None,
exit_code: int = 1,
) -> None:
super().__init__(message)
self.message = message
self.suggestion = suggestion
self.docs_url = docs_url
self.exit_code = exit_code
def format_message(self) -> str:
parts = [self.message]
if self.suggestion:
parts.append(f"\nSuggestion: {self.suggestion}")
if self.docs_url:
parts.append(f"Docs: {self.docs_url}")
return "\n".join(parts)