Possible to detect convex decomposing failing?

Godot Version

4.3

Question

Note: I’m using C# mono godot, in case it’s relevant.

Howdy! I am building a game with complex 2d shapes with dynamic destruction. I have things stable enough, where 99% of the time, I am able to generate a polygon outline for the shape in question, and set it with code like:

Vector2[] polygonPoints = GenerateCollisionPolygon();
// deferring seemed to prevent other issues with things needing to be "flushed"...
CallDeferred(nameof(SetCollisionPolygon), polygonPoints);
public void SetCollisionPolygon(Vector2[] points)
	{
		try
		{
			_collisionPolygon.Polygon = points;
		}
		catch (Exception e)
		{
			GD.Print("This Never Fires Ever!");
			GD.Print(e.Message);
			GD.Print(e.StackTrace);
		}
	}

I will see the following alerts once in a while in the errors section of the debugger:

E 0:00:20:0580   decompose_polygon_in_convex: Convex decomposing failed!
  <C++ Source>   core/math/geometry_2d.cpp:53 @ decompose_polygon_in_convex()

The problem is that it’s unclear to me if this error is catchable? Or if it’s even possible to know you’re in such a state? I would happily recover after the fact. When I turn on collision debugging the collider seems different, it’s not highlighted in red, and instead just shows the points… as in the game engine seems to understand something is broken, how can I tap into that?

UPDATE: ITS POSSIBLE!

Here is the code I use to detect when convex decomposing has failed:

private void CheckIfCollisionShapeIsValid()
{
	if (_collisionPolygon == null || _collisionPolygon.Disabled || _collisionPolygon.Polygon.Length == 0)
		return;

	int totalShapeCount = 0;
	var shapeOwners = GetShapeOwners();
	foreach (var shapeOwner in shapeOwners)
	{
		totalShapeCount += ShapeOwnerGetShapeCount((uint)shapeOwner);
	}
	// GD.Print($"Total shape count: {totalShapeCount}");
	if (totalShapeCount == 0)
	{
		GD.Print($"Asteroid {_asteroidId} has no collision shapes!!!!");
		CallDeferred(nameof(DestroyAsteroid));
	}
}

The TL;DR; is that I am able to detect that there are zero shapes owned by the rigid body (which is where this code is running, flat on the rigid body itself). This means I can detect when the points I’ve provided the collision shape are in some way breaking the convex decomposing algorithm, which means I can identify what’s going on, debug, etc. SUCCESS!!

Also just to be extra clear: it doesn’t seem possible to catch this error, but it does seem possible to identify the state.