Fix binary_search tests by adding exception handling