From 1d8881ac075fae5712f84768e89ff86451b6286e Mon Sep 17 00:00:00 2001 From: Zo Bot Date: Mon, 25 May 2026 03:40:22 +0000 Subject: [PATCH 1/2] =?UTF-8?q?narrow=20exception=20in=20clothoid=20path?= =?UTF-8?q?=20planner=20and=20state=20machine=20display=20from=20Exception?= =?UTF-8?q?=20to=20specific=20types=20=E2=80=94=20clothoid=20computations?= =?UTF-8?q?=20raise=20ValueError=20or=20TypeError;=20PlantUML=20image=20di?= =?UTF-8?q?splay=20raises=20OSError,=20ValueError,=20or=20TypeError;=20cat?= =?UTF-8?q?ching=20all=20Exception=20masked=20unrelated=20bugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MissionPlanning/StateMachine/state_machine.py | 2 +- PathPlanning/ClothoidPath/clothoid_path_planner.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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..23a3f5cfc7 100644 --- a/PathPlanning/ClothoidPath/clothoid_path_planner.py +++ b/PathPlanning/ClothoidPath/clothoid_path_planner.py @@ -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 From 3a0f5bc2b3cce86f4b9c411323c1676bd28e851b Mon Sep 17 00:00:00 2001 From: Zo Bot Date: Mon, 25 May 2026 05:39:20 +0000 Subject: [PATCH 2/2] =?UTF-8?q?narrow=20exception=20in=20generate=5Fclotho?= =?UTF-8?q?id=5Fpath=20outer=20try=20from=20Exception=20to=20(ValueError,?= =?UTF-8?q?=20TypeError)=20=E2=80=94=20numeric=20computations=20in=20solve?= =?UTF-8?q?=5Fg=5Ffor=5Froot=20and=20compute=5F*=20helpers=20only=20raise?= =?UTF-8?q?=20these=20types;=20catching=20all=20Exception=20masked=20unrel?= =?UTF-8?q?ated=20bugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PathPlanning/ClothoidPath/clothoid_path_planner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PathPlanning/ClothoidPath/clothoid_path_planner.py b/PathPlanning/ClothoidPath/clothoid_path_planner.py index 23a3f5cfc7..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