Improve error handling for dashboard and settings page