Namespaces
Variants
Views
Actions

Template:cpp/filesystem/error handling

From cppreference.com

Any overload not marked noexcept may throw std::bad_alloc if memory allocation fails.
The overload that does not take a std::error_code& parameter throws std::filesystem::filesystem_error on underlying OS API errors, constructed with the OS error code as the error code argument. The overload taking a std::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.