I have doPost(e) function in an App Script that is called by Zapier. If an exception occurs in my code, a 200 response is sent back to Zapier, but I'd like it to return a 500 error, so that Zapier knows it has failed.
function doPost(e) {
if (e) {
try {
switch (e.parameter.action) {
case 'newOrder':
processNewOrder(e.parameter.orderId, e.parameter.orderType);
break;
case 'cancelledOrder':
processCancelledOrder(e.parameter.orderId, e.parameter.orderType);
break;
}
return ContentService.createTextOutput('Done');
}
catch (err) {
throw err;
}
}
}
How can I return an exception to Zapier in that catch?