When implementing error handling or bug fixes, avoid introducing new crash conditions that would break previously working code. Focus on defensive programming that handles edge cases without creating new failure points.
When implementing error handling or bug fixes, avoid introducing new crash conditions that would break previously working code. Focus on defensive programming that handles edge cases without creating new failure points.
Key principles:
Example from accessibility handling:
// DON'T: Add new crash conditions
if (!action.hasKey("name") || !action.hasKey("label")) {
// This crashes apps that worked before without labels
// DO: Handle missing data gracefully
if (!action.hasKey("name")) {
continue; // Skip invalid actions without crashing
}
if (action.hasKey("label")) {
// Use label when available, but don't require it
}
Before adding new error conditions, consider whether the change maintains backward compatibility while still providing proper error handling for new scenarios.
Enter the URL of a public GitHub repository