error rescue for length method