Path: redb/redb.Core/Exceptions/RedbUniqueKeyValueException.cs
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Core/Exceptions/RedbUniqueKeyValueException.cs
----
using System;
namespace redb.Core.Exceptions;
///
/// A value written into a [RedbUnique] field has no canonical form — NaN, an
/// infinity — so no key can be computed for it. Raised at save time by UniqueKeyEncoder.
///
public class RedbUniqueKeyValueException : Exception
{
/// Structure (field) the value was meant for.
public long StructureId { get; }
/// Why the value cannot be a key.
public string Reason { get; }
public RedbUniqueKeyValueException(long structureId, string reason)
: base($"Value for unique key structure id={structureId} cannot be stored: {reason}.")
{
StructureId = structureId;
Reason = reason;
}
/// An object-level key (Э1, _objects._value_unique) that cannot be stored.
public RedbUniqueKeyValueException(string reason)
: base($"Object unique key cannot be stored: {reason}.")
{
Reason = reason;
}
}