Refactor silent debugging to happy path error handling
- Replaced instances of silentDebug with happy_path_error__with_fallback across multiple files to improve error logging and handling. - Updated the utility function to provide clearer semantics for error handling when expected values are missing. - Introduced a script to find potential silent failures in the codebase that may need to be addressed with the new error handling approach.
This commit is contained in:
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
# Find Silent Failure Patterns
|
||||
#
|
||||
# This script searches for defensive OR patterns (|| '' || null || undefined)
|
||||
# that should potentially use happy_path_error__with_fallback instead.
|
||||
#
|
||||
# Usage: ./scripts/find-silent-failures.sh
|
||||
|
||||
echo "=================================================="
|
||||
echo "Searching for defensive OR patterns in src/"
|
||||
echo "These MAY be silent failures that should log errors"
|
||||
echo "=================================================="
|
||||
echo ""
|
||||
|
||||
echo "🔍 Searching for: || ''"
|
||||
echo "---"
|
||||
grep -rn "|| ''" src/ --include="*.ts" --color=always || echo " (none found)"
|
||||
echo ""
|
||||
|
||||
echo "🔍 Searching for: || \"\""
|
||||
echo "---"
|
||||
grep -rn '|| ""' src/ --include="*.ts" --color=always || echo " (none found)"
|
||||
echo ""
|
||||
|
||||
echo "🔍 Searching for: || null"
|
||||
echo "---"
|
||||
grep -rn "|| null" src/ --include="*.ts" --color=always || echo " (none found)"
|
||||
echo ""
|
||||
|
||||
echo "🔍 Searching for: || undefined"
|
||||
echo "---"
|
||||
grep -rn "|| undefined" src/ --include="*.ts" --color=always || echo " (none found)"
|
||||
echo ""
|
||||
|
||||
echo "=================================================="
|
||||
echo "Review each match and determine if it should use:"
|
||||
echo " happy_path_error__with_fallback('description', data, fallback)"
|
||||
echo "=================================================="
|
||||
Reference in New Issue
Block a user