Catch exceptions thrown by std::thread and return a meaningful error code in libfsw.