raise PlantError("tomato")
except PlantError as e:
print(f"Caught PlantError: {e}")
+ print()
print("Testing WaterError...")
try:
raise WaterError()
except WaterError as e:
print(f"Caught WaterError: {e}")
+ print()
print("Testing catching all garden errors...")
try:
print(f"Added {plant} successfully")
except (ValueError, GardenError) as e:
print(f"Error adding plant: {e}")
+ print()
- print("\nWatering plants...")
+ print("Watering plants...")
manager.water_plants(["tomato", "lettuce"])
+ print()
- print("\nChecking plant health...")
+ print("Checking plant health...")
for plant in ["tomato", "lettuce"]:
try:
manager.check_plant_health(plant)
except GardenError as e:
print(f"Error checking {plant}: {e}")
+ print()
- print("\nTesting error recovery...")
+ print("Testing error recovery...")
try:
raise WaterError()
except GardenError as e: