OptrisOptrisDocumentation

Documentation/OTC SDK/OTC SDK — C++ API referencev12.0

optris::sdk::PathExistsException

A file is already at the path, and it will not be destroyed.

Thrown by Recorder::Start() when a regular file is already at the output path. Nothing is opened, nothing is truncated, and the file that is there is untouched; the message names the path.

Why it is a type and not only a message: Why it is a type and not only a message As a plain SdkException the only way to tell "that name is taken" from a bad duration was to match the English in the message, and across the C ABI it arrived as OPTRIS_SDK_ERROR_UNKNOWN. An application that chooses another name and retries has to be able to recognise this case, and only this case.

A subclass of SdkException and not of ConfigException or IoException: every catch ([SdkException](/documentation/sdks/otc-sdk/v12.0/api/classes/optris.sdk.sdkexception) &) already written keeps catching it, and nothing failed to be read or written -- the SDK deliberately did not try.

The fix in calling code is one line, std::filesystem::remove(), for a caller that means to overwrite a fixed name.

Crosses the C ABI as OPTRIS_SDK_ERROR_ALREADY_EXISTS and reaches C# as PathExistsException, Python as PathExistsError and Rust as Status::AlreadyExists.

Inherits from optris::sdk::SdkException.