diff --git a/MissionPlanning/StateMachine/state_machine.py b/MissionPlanning/StateMachine/state_machine.py index 454759236e..1522bcd330 100644 --- a/MissionPlanning/StateMachine/state_machine.py +++ b/MissionPlanning/StateMachine/state_machine.py @@ -288,7 +288,7 @@ def generate_plantuml(self) -> str: plt.imshow(imread(BytesIO(content), format="png")) plt.axis("off") plt.show() - except Exception as e: + except (OSError, ValueError, TypeError) as e: print(f"Error showing PlantUML: {e}") return plant_uml_text diff --git a/PathPlanning/ClothoidPath/clothoid_path_planner.py b/PathPlanning/ClothoidPath/clothoid_path_planner.py index 5e5fc6e9a3..4b8a28fb31 100644 --- a/PathPlanning/ClothoidPath/clothoid_path_planner.py +++ b/PathPlanning/ClothoidPath/clothoid_path_planner.py @@ -73,7 +73,7 @@ def generate_clothoid_path(start_point, start_yaw, L = compute_path_length(r, phi1, delta, A) curvature = compute_curvature(delta, A, L) curvature_rate = compute_curvature_rate(A, L) - except Exception as e: + except (ValueError, TypeError) as e: print(f"Failed to generate clothoid points: {e}") return None @@ -86,7 +86,7 @@ def generate_clothoid_path(start_point, start_yaw, y = start_point.y + s * Y(curvature_rate * s ** 2, curvature * s, start_yaw) points.append(Point(x, y)) - except Exception as e: + except (ValueError, TypeError) as e: print(f"Skipping failed clothoid point: {e}") return points