Skip to content

Commit

Permalink
fix: async/await return err syntax and revert structured err logging
Browse files Browse the repository at this point in the history
  • Loading branch information
heitorlessa committed Jul 21, 2018
1 parent 8590483 commit 6068036
Showing 1 changed file with 4 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,8 @@ exports.lambda_handler = function (event, context, callback) {
callback(null, response);
})
.catch(function (err) {
error = {
"lambda_request_id": context.awsRequestId,
"lambda_log_group": context.logGroupName,
"lambda_log_stream": context.logStreamName,
"apigw_request_id": event.requestContext.requestId,
"error_message": err,
}

console.error(error);

response = {
'statusCode': 500,
'body': JSON.stringify({
message: 'Something went wrong :(',
request_id: error.apigw_request_id
})
}

callback(null, response);
console.log(err);
callback(err);
});
};
{%- else %}
Expand All @@ -90,25 +73,8 @@ exports.lambda_handler = async (event, context) => {
}
}
catch (err) {
error = {
"lambda_request_id": context.awsRequestId,
"lambda_log_group": context.logGroupName,
"lambda_log_stream": context.logStreamName,
"apigw_request_id": event.requestContext.requestId,
"error_message": err,
}

console.error(error);

response = {
'statusCode': 500,
'body': JSON.stringify({
message: 'Something went wrong :(',
request_id: error.apigw_request_id
})
}

return response
console.log(err);
return err;
}

return response
Expand Down

0 comments on commit 6068036

Please sign in to comment.