Table of Contents

Class DynamoDbMappingException

Namespace
DynaSharp
Assembly
DynaSharp.dll

An item cannot be mapped to its .NET type: an attribute is missing, has a value the type cannot hold, or the item is of another type. The service did what it was asked, so this is never retried. In particular, an UpdateItem whose returned attribute is missing has been applied.

public sealed class DynamoDbMappingException : Exception, ISerializable
Inheritance
DynamoDbMappingException
Implements
Inherited Members

Remarks

The message names the type and the attribute, never a value; the one exception is the discriminator of an item of another type, which is the name of that type. InnerException can be a FormatException that quotes the value, so take care when logging ToString() of it. Key says which item it was, for code that can act on it: it holds values, and neither the message nor telemetry show them.

Constructors

DynamoDbMappingException(string, string?, Exception?)

Initializes a new instance of the DynamoDbMappingException class.

public DynamoDbMappingException(string entityType, string? attributeName, Exception? innerException = null)

Parameters

entityType string

The .NET type that was read.

attributeName string

The attribute, if the failure is about one.

innerException Exception

The conversion that failed, if any.

Properties

AttributeName

Gets the attribute the failure is about, or null if it is about the item.

public string? AttributeName { get; }

Property Value

string

EntityType

Gets the .NET type that was read.

public string EntityType { get; }

Property Value

string

Key

Gets the key attributes of the item that could not be read, which is how a row a new deployment wrote is found in a query of many. It is filled by Get, Query, Scan, a fan-out, a batch get and a mixed read, and it is the key of the table also for a read of an index. null for an item that holds no key attribute, and for what other reads of an item throw, whose key the caller gave. It holds values, so take care where it goes.

public Item? Key { get; }

Property Value

Item

Methods

IsConversionFailure(Exception)

Determines whether an exception is one that a converter throws for a value it cannot convert, which generated code wraps in a DynamoDbMappingException.

public static bool IsConversionFailure(Exception exception)

Parameters

exception Exception

The exception.

Returns

bool

true for a failed conversion.

KeyDoesNotFit(string, string)

Creates the exception for a key that does not fit its template, so that what only the key holds cannot be read from it. The message holds no value.

public static DynamoDbMappingException KeyDoesNotFit(string entityType, string attributeName)

Parameters

entityType string

The .NET type that was read.

attributeName string

The attribute of the key.

Returns

DynamoDbMappingException

The exception.

Missing(string, string)

Creates the exception for a required attribute the item does not have.

public static DynamoDbMappingException Missing(string entityType, string attributeName)

Parameters

entityType string

The .NET type that was read.

attributeName string

The attribute.

Returns

DynamoDbMappingException

The exception.

Missing(string, string, string)

Creates the exception for a required attribute the item does not have, where a key of the item could have stood in for it, and did not. The message holds no value.

public static DynamoDbMappingException Missing(string entityType, string attributeName, string keyAttribute)

Parameters

entityType string

The .NET type that was read.

attributeName string

The attribute.

keyAttribute string

The attribute of the key that holds the value too. It is missing, or it does not fit its template, which is what to look at first.

Returns

DynamoDbMappingException

The exception.

OtherType(string, string, string)

Creates the exception for an item of another type, which a query over an overloaded prefix can return.

public static DynamoDbMappingException OtherType(string entityType, string attributeName, string foundType)

Parameters

entityType string

The .NET type that was read.

attributeName string

The attribute that holds the discriminator.

foundType string

The discriminator the item has.

Returns

DynamoDbMappingException

The exception.

UndefinedEnumValue(string)

Creates the exception for an enum value without a name, for example a cast from a number, on its way into an item.

public static DynamoDbMappingException UndefinedEnumValue(string enumType)

Parameters

enumType string

The enum.

Returns

DynamoDbMappingException

The exception.