improve exception message for closures