PropertyAlreadyExistsException

Thrown when attempting to add a property that already exists in the store.

This exception is thrown by property store operations when trying to create or add a property with a name that is already present in the store. This prevents accidental overwrites and maintains data integrity.

To avoid this exception, either:

  • Check if the property exists before adding it

  • Use an update operation instead of create/add

  • Remove the existing property first, then add the new one

Example:

val store = InMemoryPropertyStore()

// Safe approach - check existence first
if ("timeout" !in store) {
store += intProperty("timeout") { value = 30 }
}

// Or handle the exception
try {
store += intProperty("timeout") { value = 30 }
} catch (e: PropertyAlreadyExistsException) {
store.updateProperty(intProperty("timeout") { value = 30 })
}

Parameters

propertyName

The name of the property that already exists

See also

Constructors

Link copied to clipboard
constructor(propertyName: String)

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard
open val message: String?