code: public void methodErrorHook(String hookedClassQualifiedName,
              String hookedMethodSimpleName, Throwable e) {
          if (currentRunResult == null) {
              return; // maybe called outside of the root method
          }
          TestMethod rootMethod = currentRunResult.getRootMethod();
          if (!rootMethod.getTestClassKey().equals(hookedClassQualifiedName)
                  || !rootMethod.getSimpleName().equals(hookedMethodSimpleName)) {
              return; // hooked method is not current root method
          }
  
          RunFailure runFailure = new RunFailure();
          runFailure.setMessage(e.getClass().getCanonicalName() + ": " + e.getLocalizedMessage());
          runFailure.setStackTrace(ExceptionUtils.getStackTrace(e));
          LineReplacer replacer = new LineReplacer() {
  
              @Override
              public void replace(String classQualifiedName, String methodSimpleName, int line) {
                  super.replace(classQualifiedName, methodSimpleName, line);
                  if (StringUtils.equals(methodSimpleName, currentActualRootMethodSimpleName)) {
                      replaceMethodSimpleName(currentRunResult.getRootMethod().getSimpleName());
                  }
              }
          };
          List<StackLine> stackLines = StackLineUtils.getStackLines(srcTree, e.getStackTrace(), replacer);
          for (StackLine stackLine : stackLines) {
              runFailure.addStackLine(stackLine);
          }
          currentRunResult.addRunFailure(runFailure);
  
          captureScreenForStackLines(rootMethod, Arrays.asList(stackLines), Arrays.asList(-1));
      }
docs: This method must be called before afterMethodHook is called