/** * Executes the specified task, handling a any exception that occurs. * @param runnable * the task to be executed * @return * the execution result monad */ public static ExecutionResult<Void> runProtected(Runnable runnable) { //NOSONAR try { runnable.run(); //NOSONAR return ExecutionResult.ofVoid(); } catch (Exception e) { return ExecutionResult.ofException(e); } }