JSFiddle - React, Tailwind, and code Playground
JavaScript
let funcA = function(event) {
try {
let body = JSON.parse(event.body);
body.payload.env = "prd";
return body;
} catch(e) {
let body = {error:e};
console.log(JSON.stringify(body));
throw e;
}
}
let a = "{body:'myBody'}";
try {
console.log(funcA(a));
} catch(e) {
console.log(e);
}