Template:cpp/experimental/fs/error handling
From cppreference.com
The overload that does not take an error_code& parameter throws filesystem_error on underlying OS API errors, constructed with the OS error code as the error code argument. std::bad_alloc may be thrown if memory allocation fails. The overload taking an error_code& parameter sets it to the OS API error code if an OS API call fails, and executes ec.clear() if no errors occur. This overload has
noexcept specification:
noexcept