Loading...
Loading...
Provides robust error handling strategies and patterns. Use when the user mentions resilience, error handling, fallbacks, or debugging failures.
npx skill4agent add roelofvheeren/elvison-os handling-errors# Logic: CLOSED -> failure threshold reached -> OPEN (wait timeout) -> HALF_OPEN (test)class ErrorCollector {
private errors: Error[] = [];
add(error: Error) { this.errors.push(error); }
throw() { if (this.errors.length) throw new AggregateError(this.errors); }
}def with_fallback(primary, fallback):
try: return primary()
except Exception: return fallback()ApplicationError(Exception)@contextmanagertry/finallytype Result<T, E> = { ok: true; value: T } | { ok: false; error: E }catchResult<T, E>?if err != nilfmt.Errorf("...: %w", err)