jeudi 21 juillet 2016

What are the best practice of making code error stable?

I need make some code super stable and make sure all exceptions thrown within a block don't stop the code execution.

For now i have the following solution:

iterated.map(it -> {
   try {
      handleElement(it);
   } catch (Exception e) {
      handleError(e);
   }
});

But from the other side i feel like there should be more elegant way to do it. Please help me to find it.

Aucun commentaire:

Enregistrer un commentaire