I am reading clean code which is written by Robert C. Martin in the 7 section about error handling There is a piece of code that I could not understand it.
try {
MealExpenses expenses = expenseReportDAO.getMeals(employee.getID());
m_total += expenses.getTotal();
} catch(MealExpensesNotFound e) {
m_total += getMealPerDiem();
}
what does it mean? and it is written that we need to refactor it via special case pattern like the following:
public class PerDiemMealExpenses implements MealExpenses {
public int getTotal() {
// return the per diem default
}
}
Can you translate it in a simple way for me? thank you in advance.
Aucun commentaire:
Enregistrer un commentaire