export class TryCatchExample {
mtdExample() {
try {
for (editIndex = 0; editIndex < partner.objProjects.length; editIndex++)
{
if (partner.objProjects[editIndex].id == req.body.projectId) {found = true; break;}
}
if (!found)
{
return res.status(404).json({
title: "Project not found",
error: {message: "The passed ID does not match any project for this charity"}
});
}
for (updateIndex = 0; updateIndex < partner.objProjects[editIndex].objUpdates.length; updateIndex++)
{
if (partner.objProjects[editIndex].objUpdates[updateIndex].id == req.body.updateId) {updateFound = true; break;}
}
} catch(e) {
// We assume because it was the header set error.
console.log("The header was already set.");
} // try / catch
}
}