proper error handling for searches