Added: Common error handling