How we can handle exception getting from Dynamo Db DAX client in nodejs.I am using amazon-dax-client library.Also I want to redirect my request to Dynamo Db client if in case DAX Connection fails.
Below is the reference Code i am trying to achieve it
var ddbClient = new AWS.DynamoDB.DocumentClient({ convertEmptyValues: true,maxRetries: 15 });
var daxClient: any = null;
if (process.env.ENDPOINT) {
try {
var dax = new AmazonDaxClient({
endpoints: [process.env.ENDPOINT],
region: Constants.AWS.REGION,
maxRetries: 15
});
daxClient = new AWS.DynamoDB.DocumentClient({ service: dax });
} catch (error) {
console.log("eror",error)
}
}
this.client = daxClient != null ? daxClient : ddbClient;