Lisp

Lambda expression and small “around” method to reduce DRY

When you are acting as façade or in any other “forward-like” role sometimes error handling may come pretty boring stuff to deal with. For instance if you are acting as front-end client proxy class for some REST Api behind the scenes, code below may look familiar – that you have to replicate yourself all the time and catch for instance in this case IO error and response content format error (if they return invalid formatted Json object). protected void Operation1() { try { // some black magic happens here.. } catch (HttpRequestException e) { // handle IO…

Keep reading