title: Dynamo DB- Lambda Function Not returning error?
body: <p>I have userName and className as partition and sort key in dynamo DB table. When inserting duplicate records I am getting error on AWS web console as expected.( Status Code: 400; Error Code: ConditionalCheckFailedException;). Now I am trying to insert the record from lambda function with following code. It is working fine as expected for first time on unique record. But when I am trying to insert the same record is it not supposed to throw me same error ? I am not getting errors as response back. 
  whats wrong with this? FYI.. duplicates records not being inserted though(at least this is happening as expected)..</p>
  
  <pre><code>const AWS = require('aws-sdk');
  // const dynamoDB = new AWS.DynamoDB({region: 'us-east-2', apiVersion: '2012-08-10'});
  const docClient = new AWS.DynamoDB.DocumentClient({
      region: 'us-east-2',
      apiVersion: '2012-08-10'
  });
  exports.handler = (event, context, callback) =&gt; {
      var params = {
          Item: {
              userName: event.userName,
              className: event.className
          },
          ReturnValues: "ALL_OLD",
          TableName: "IRAT-COLLECTIONS"
      };
      docClient.put(params, function(err, data) {
          if (err) {
              console.log(err)
              callback(err);
          } else {
              console.log('data successfully written')
              console.log(data)
              callback(null, data);
          }
      })
  };
  </code></pre>