Code review comment: Shall we handle the error properly without using `printStackTrace()`?

Code under review:
private static void runOnSchedule(Class<?> initClazz, BLangIdentifier name, Scheduler scheduler1) {
        String funcName = cleanupFunctionName(name);
        try {
            final Method method = initClazz.getDeclaredMethod(funcName, Strand.class);
            Scheduler scheduler = scheduler1;
            
            Function<Object[], Object> func = objects -> {
                try {
                    return method.invoke(null, objects[0]);
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                }
                return null;
            };
            final FutureValue out = scheduler.schedule(new Object[1], func, null, null, null);
            scheduler.start();
            if (out.panic != null) {
                throw new RuntimeException("Error in init/start", out.panic);
            }
            
            
            
            
            
            
            
            
            
            
            
            
            
            
        } catch (Exception e) {
            throw new RuntimeException("Error while invoking function '" + funcName + "'", e);
        }
    }

Line commented on: e.printStackTrace();

Revised code:
private static void runOnSchedule(Class<?> initClazz, BLangIdentifier name, Scheduler scheduler1) {
        String funcName = cleanupFunctionName(name);
        try {
            final Method method = initClazz.getDeclaredMethod(funcName, Strand.class);
            Scheduler scheduler = scheduler1;
            
            Function<Object[], Object> func = objects -> {
                try {
                    return method.invoke(null, objects[0]);
                } catch (InvocationTargetException e) {
                    throw (RuntimeException) e.getTargetException();
                } catch (IllegalAccessException e) {
                    throw new BallerinaException("Method has private access", e);
                }
            };
            final FutureValue out = scheduler.schedule(new Object[1], func, null, null, null);
            scheduler.start();
            final Throwable t = out.panic;
            if (t != null) {
                if (t instanceof org.ballerinalang.jvm.util.exceptions.BLangRuntimeException) {
                    throw new org.ballerinalang.util.exceptions.BLangRuntimeException(t.getMessage());
                }
                if (t instanceof org.ballerinalang.jvm.util.exceptions.BallerinaConnectorException) {
                    throw new org.ballerinalang.util.exceptions.BLangRuntimeException(t.getMessage());
                }
                if (t instanceof ErrorValue) {
                    throw new org.ballerinalang.util.exceptions.BLangRuntimeException(
                            "error: " + ((ErrorValue) t).getPrintableStackTrace());
                }
                throw (RuntimeException) t;
            }
        } catch (NoSuchMethodException e) {
            throw new RuntimeException("Error while invoking function '" + funcName + "'", e);
        }
    }