Fixed error handling for generic (non-API-related) errors