Skip to main content

robust-error-handling-in-scripts

Use this skill when writing shell scripts, Python automation, or any unattended batch job. Ensure failures are detected, logged, and handled — never silently ignored.

Quellinformationen

Repository
aiming-lab/MetaClaw
Letzte Quellaktivität
10. März 2026 um 18:04
Erkannte Sprache von SKILL.md
Englisch
Sterne
3.464
Forks
452

Installationsoptionen

Standardmäßig ist der Prompt ausgewählt, der zuerst die Quelle prüft. Sie können zu einem direkten Befehl wechseln oder eine lokale Kopie herunterladen.

Quelldateien prüfen

Lesen Sie SKILL.md und alle von SkillsMP angezeigten Begleitdateien, bevor Sie sich für eine Installation entscheiden.

SKILL.md wird angezeigt

SKILL.md
Quellanweisungen · Schreibgeschützte Vorschau
name
robust-error-handling-in-scripts
description
Use this skill when writing shell scripts, Python automation, or any unattended batch job. Ensure failures are detected, logged, and handled — never silently ignored.
category
automation
# Robust Error Handling in Scripts **Shell scripts:** ```bash set -euo pipefail # Exit on error, undefined var, pipe failure trap 'echo "Failed at line $LINENO"' ERR ``` **Python scripts:** ```python import logging, sys logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s') try: main() except Exception as e: logging.exception("Unhandled error: %s", e) sys.exit(1) ``` **Retry with backoff** for transient network/API failures: ```python from tenacity import retry, stop_after_attempt, wait_exponential @retry(stop=stop_after_attempt(3), wait=wait_exponential(min=2, max=10)) def call_api(): ... ```
Auf GitHub ansehen