thread-safe error handling in stringdistances