Template:cpp/experimental/fs/error handling

The overload that does not take a parameter throws  on underlying OS API errors, constructed with  the OS error code as the error code argument. may be thrown if memory allocation fails. The overload taking a parameter sets it to the OS API error code if an OS API call fails, and executes  if no errors occur. This overload has