@Override
    public void execute(FunctionContext context) {
      // first send some results
      for (int index = 0; index < 5; ++index) {
        context.getResultSender().sendResult(index);
      }
      // then throw an exception
      throw new NullPointerException("Thrown by " + context.getMemberName());
    }
Simple function that throws NullPointerException after sending some results.
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/FunctionExceptionsIncludeLocalMemberRegressionTest.java