Files
proxmox/scripts/lib/error-handling.sh
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands
- CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround
- CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check
- NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere
- MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates
- LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 15:46:57 -08:00

40 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Error handling utilities
# err_exit is defined in load-project-env.sh when sourced; fallback here for standalone use
err_exit() { echo "ERROR: $1" >&2; exit 1; }
handle_rpc_error() {
local error="$1"
if echo "$error" | grep -q "insufficient funds"; then
echo "ERROR: Insufficient balance for transaction"
return 1
elif echo "$error" | grep -q "nonce too low"; then
echo "ERROR: Transaction nonce too low. Wait for pending transactions."
return 1
elif echo "$error" | grep -q "replacement transaction underpriced"; then
echo "ERROR: Pending transaction exists. Wait or increase gas price."
return 1
elif echo "$error" | grep -q "execution reverted"; then
echo "ERROR: Transaction reverted. Check contract state."
return 1
fi
return 0
}
retry_transaction() {
local command="$1"
local max_retries=3
local retry=0
while [ $retry -lt $max_retries ]; do
if eval "$command"; then
return 0
fi
((retry++))
sleep 5
done
return 1
}