47fac22230
- .claude/CLAUDE.md - .claude/commands/subagentes.md - .claude/rules/INDEX.md - .mcp.json - bash/functions/cybersecurity/analyze_dns.md - bash/functions/cybersecurity/audit_http_headers.md - bash/functions/cybersecurity/audit_ssh_config.md - bash/functions/cybersecurity/check_firewall.md - bash/functions/cybersecurity/detect_suspicious_users.md - bash/functions/cybersecurity/encrypt_file.md - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2.1 KiB
2.1 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path, source_repo, source_license, source_file
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | params | output | tested | tests | test_file_path | file_path | source_repo | source_license | source_file | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| bash_handle_error | function | bash | shell | 1.0.0 | impure | handle_error(error_code: string, error_description: string, [solution: string]) -> exit_code | Muestra un box de error formateado con contexto del fallo: script, linea, funcion, directorio y usuario. Registra en log. |
|
|
false | error_go_core |
|
box de error formateado en stdout con contexto (script, linea, funcion, directorio, usuario) + registro en log; retorna exit code 1 | false | bash/functions/shell/bash_handle_error.sh | https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/egutierrez/DevLauncher.git | MIT | scripts/lib/common.sh |
Ejemplo
source bash/functions/shell/bash_handle_error.sh
build_project() {
go build ./... || handle_error "BUILD_FAILED" \
"La compilacion del proyecto fallo" \
"Ejecuta 'go mod tidy' y verifica que todas las dependencias esten instaladas"
}
connect_db() {
psql "$DB_URL" -c '\q' 2>/dev/null || handle_error "DB_CONNECTION_ERROR" \
"No se pudo conectar a la base de datos"
}
Notas
El box usa caracteres unicode de bash_colors (BOX_TL, BOX_H, etc.) para el borde en rojo. La informacion de contexto se extrae de BASH_SOURCE, BASH_LINENO y FUNCNAME con offset 2 para apuntar al caller del caller.
La funcion siempre retorna 1, permitiendo usarla como cmd || handle_error ... en pipelines de error.
Usa bash_colors y bash_log como dependencias. Sourcea ambas automaticamente al cargarse.