Implement verbose error feedback across all scripts
- Enhanced die() function with environment context and stack trace - Added detailed error output with line numbers and file paths - Improved check_dependencies with installation guides - Enhanced PHP syntax validation with full error details - Added verbose error messages to manifest, tabs, and paths validations - Updated validate_all to show error summaries (full output in verbose mode) - Updated smoke_test with detailed PHP error reporting - Updated ENTERPRISE.md with verbose error examples - All error messages now provide actionable troubleshooting steps Co-authored-by: jmiller-moko <230051081+jmiller-moko@users.noreply.github.com>
This commit is contained in:
@@ -150,16 +150,29 @@ log_info "Checking PHP syntax..."
|
||||
|
||||
if command -v php >/dev/null 2>&1; then
|
||||
php_errors=0
|
||||
failed_files=()
|
||||
while IFS= read -r -d '' f; do
|
||||
if ! php -l "$f" >/dev/null 2>&1; then
|
||||
if ! php_output=$(php -l "$f" 2>&1); then
|
||||
log_error "PHP syntax error in: $f"
|
||||
echo " Error details:" >&2
|
||||
echo "$php_output" | sed 's/^/ /' >&2
|
||||
echo "" >&2
|
||||
php_errors=$((php_errors + 1))
|
||||
failed_files+=("$f")
|
||||
fi
|
||||
done < <(find src -type f -name '*.php' -print0 2>/dev/null)
|
||||
|
||||
if [ "${php_errors}" -eq 0 ]; then
|
||||
log_info "✓ PHP syntax validation passed"
|
||||
else
|
||||
echo "Summary of PHP syntax errors:" >&2
|
||||
echo " Total errors: ${php_errors}" >&2
|
||||
echo " Failed files:" >&2
|
||||
for f in "${failed_files[@]}"; do
|
||||
echo " - $f" >&2
|
||||
done
|
||||
echo "" >&2
|
||||
echo "To fix: Run 'php -l <filename>' on each failed file for detailed error messages." >&2
|
||||
die "Found ${php_errors} PHP syntax errors"
|
||||
fi
|
||||
else
|
||||
|
||||
@@ -139,22 +139,20 @@ for check in "${REQUIRED_CHECKS[@]}"; do
|
||||
fi
|
||||
|
||||
log_step "Running: ${check}"
|
||||
if [ "${VERBOSE}" = "true" ]; then
|
||||
if "${script}"; then
|
||||
log_success "✓ ${check}"
|
||||
required_passed=$((required_passed + 1))
|
||||
else
|
||||
log_error "✗ ${check} (FAILED)"
|
||||
required_failed=$((required_failed + 1))
|
||||
fi
|
||||
# Always capture output for better error reporting
|
||||
output=""
|
||||
if output=$("${script}" 2>&1); then
|
||||
log_success "✓ ${check}"
|
||||
required_passed=$((required_passed + 1))
|
||||
[ "${VERBOSE}" = "true" ] && echo "$output"
|
||||
else
|
||||
if "${script}" >/dev/null 2>&1; then
|
||||
log_success "✓ ${check}"
|
||||
required_passed=$((required_passed + 1))
|
||||
else
|
||||
log_error "✗ ${check} (FAILED - run with -v for details)"
|
||||
required_failed=$((required_failed + 1))
|
||||
fi
|
||||
log_error "✗ ${check} (FAILED)"
|
||||
required_failed=$((required_failed + 1))
|
||||
# Show error output for required checks regardless of verbose flag
|
||||
echo "" >&2
|
||||
echo "Error output:" >&2
|
||||
echo "$output" >&2
|
||||
echo "" >&2
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -170,21 +168,27 @@ for check in "${OPTIONAL_CHECKS[@]}"; do
|
||||
fi
|
||||
|
||||
log_step "Running: ${check}"
|
||||
if [ "${VERBOSE}" = "true" ]; then
|
||||
if "${script}"; then
|
||||
log_success "✓ ${check}"
|
||||
optional_passed=$((optional_passed + 1))
|
||||
else
|
||||
log_warn "✗ ${check} (warnings/issues found)"
|
||||
optional_failed=$((optional_failed + 1))
|
||||
fi
|
||||
# Capture output for better error reporting
|
||||
output=""
|
||||
if output=$("${script}" 2>&1); then
|
||||
log_success "✓ ${check}"
|
||||
optional_passed=$((optional_passed + 1))
|
||||
[ "${VERBOSE}" = "true" ] && echo "$output"
|
||||
else
|
||||
if "${script}" >/dev/null 2>&1; then
|
||||
log_success "✓ ${check}"
|
||||
optional_passed=$((optional_passed + 1))
|
||||
log_warn "✗ ${check} (warnings/issues found)"
|
||||
optional_failed=$((optional_failed + 1))
|
||||
# Show brief error summary for optional checks, full output in verbose
|
||||
if [ "${VERBOSE}" = "true" ]; then
|
||||
echo "" >&2
|
||||
echo "Error output:" >&2
|
||||
echo "$output" >&2
|
||||
echo "" >&2
|
||||
else
|
||||
log_warn "✗ ${check} (warnings/issues found - run with -v for details)"
|
||||
optional_failed=$((optional_failed + 1))
|
||||
# Show first few lines of error
|
||||
echo "" >&2
|
||||
echo "Error summary (run with -v for full details):" >&2
|
||||
echo "$output" | head -5 >&2
|
||||
echo "" >&2
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user