Use std::system_category().message(err), which internally dispatches to strerror_r/s, and should handle unknown errors.
See: https://github.com/llvm/llvm-project/blob/4e9e83400a5702059c8a18e2fb6174038875e8a6/libcxx/src/system_error.cpp#L231-L237 for one standard library implementation.