i am working with ServiceStack.Aws and i am getting an ResourceNotFoundException, but i can't see the resource name that it looking for. ¿The resource name are sent in the exception? ¿How can i get it?
My model class is (table and index name exists)
[DynamoDBTable("SOME-TABLE-NAME")]
public class Company
{
[DynamoDBHashKey]
public string CompanyId { get; set; }
[DynamoDBGlobalSecondaryIndexHashKey("SOME-INDEX-NAME")]
public string ShortName { get; set; }
public string DocumentNumber { get; set; }
public string FullName { get; set; }
public string Address { get; set; }
public DateTime CreatedAt { get; set; }
}
My code is
var awsDb = new AmazonDynamoDBClient();
var db = new PocoDynamo(awsDb);
db.RegisterTable<Company>();
try
{
db.PutItem<Company>(new Company
{
Address = "Some address #some number",
CompanyId = Guid.NewGuid().ToString(),
CreatedAt = DateTime.Now,
DocumentNumber = "11.222.333-4",
FullName = "Some company name",
ShortName = "ShortName"
});
}
catch (ResourceNotFoundException ex)
{
}
catch (Exception ex)
{
}
In my app.config i have (path and profile name exists. Region is ok too)
<aws region="us-east-1" profileName="profile-name" profilesLocation="some-path\certificados.txt">
</aws>
Edit: The problem is that ServiceStack don't use AWS Attributes. So, i change DynamoDBTable to Alias and all work fine
ServiceStack.Aws's PocoDynamo automatically retries temporary exceptions behind-the-scenes so the original AWS exception may have been retried. I've just added an ExceptionFilter
in this commit which will let you inspect each Exception thrown by AWS DynamoDB client with:
var dynamo = new PocoDynamo(awsDynamoClient) {
ExceptionFilter = ex => ex.Message.Print();
};
The ExceptionFilter is available from v4.0.61 that's now available on MyGet.
Also [DynamoDBGlobalSecondaryIndexHashKey]
attribute has no effect in PocoDynamo, please see the docs on creating Global Indexes with PocoDynamo.