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:
@@ -59,25 +59,44 @@ fi
|
||||
failed=0
|
||||
checked=0
|
||||
failed_files=()
|
||||
failed_errors=()
|
||||
|
||||
while IFS= read -r -d '' f; do
|
||||
checked=$((checked+1))
|
||||
|
||||
# Capture actual error output
|
||||
error_output=""
|
||||
|
||||
# Use timeout if available to prevent hangs
|
||||
if command -v timeout >/dev/null 2>&1; then
|
||||
if ! timeout "${TIMEOUT}" php -l "$f" >/dev/null 2>&1; then
|
||||
if ! error_output=$(timeout "${TIMEOUT}" php -l "$f" 2>&1); then
|
||||
failed=1
|
||||
failed_files+=("$f")
|
||||
failed_errors+=("$error_output")
|
||||
fi
|
||||
else
|
||||
if ! php -l "$f" >/dev/null 2>&1; then
|
||||
if ! error_output=$(php -l "$f" 2>&1); then
|
||||
failed=1
|
||||
failed_files+=("$f")
|
||||
failed_errors+=("$error_output")
|
||||
fi
|
||||
fi
|
||||
done < <(find "${SRC_DIR}" -type f -name '*.php' -print0)
|
||||
|
||||
if [ "${failed}" -ne 0 ]; then
|
||||
echo "ERROR: PHP syntax validation failed" >&2
|
||||
echo "Files checked: ${checked}" >&2
|
||||
echo "Files with errors: ${#failed_files[@]}" >&2
|
||||
echo "" >&2
|
||||
echo "Failed files and errors:" >&2
|
||||
for i in "${!failed_files[@]}"; do
|
||||
echo " File: ${failed_files[$i]}" >&2
|
||||
echo " Error: ${failed_errors[$i]}" >&2
|
||||
echo "" >&2
|
||||
done
|
||||
echo "" >&2
|
||||
echo "To fix: Review and correct the syntax errors in the files listed above." >&2
|
||||
echo "Run 'php -l <filename>' on individual files for detailed error messages." >&2
|
||||
{
|
||||
printf '{"status":"fail","error":"php_lint_failed","files_checked":%s,"failed_count":%s,"failed_files":[' "${checked}" "${#failed_files[@]}"
|
||||
for i in "${!failed_files[@]}"; do
|
||||
|
||||
Reference in New Issue
Block a user