use specific exception for invalid curvatures/tangents and improve performance