OptrisOptrisDocumentation

Documentation/OTC SDK/Optris.Sdk — C# API referencev12.0

PathExistsException

public sealed class PathExistsException : SdkConfigurationException

A file is already at the path, and the SDK will not destroy it.

Thrown by ThermalCamera.StartRecording(…) and its overloads 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.

A subclass of SdkConfigurationException, which is what this case arrived as from the recording-session and snapshot paths, so catch (SdkConfigurationException) keeps catching what it caught. From the camera's own path it arrived as the base OptrisSdkException, because the native refusal had no status of its own and fell through to OPTRIS_SDK_ERROR_UNKNOWN, so an occupied path could not be told from an unclassified failure without reading the message.

Not SdkIOException: nothing failed to be read or written, the SDK deliberately did not try. A caller that means to overwrite a fixed name (a latest.mkv, a nightly that reuses one path) deletes the file itself first, which is the whole of the migration and is loud rather than silent.

Example

try
{
    camera.StartRecording(path);
}
catch (PathExistsException)
{
    path = NextFreeName(path);
    camera.StartRecording(path);
}

PathExistsException: constructors

public PathExistsException(string message)

Create the exception.

  • message: What went wrong.
public PathExistsException(string message, int status)

Create the exception with its native status.

  • message: What went wrong.
  • status: The native status code.