private void addCatchForMethod(
            CtClass clazz,
            CtMethod method,
            CtClass exceptionType,
            String target)
            throws NotFoundException, CannotCompileException {

        ClassUtils.DelegateResult result =
                ClassUtils.newMethodDelegate(clazz, method, null);

        CtMethod srcMethod = result.getSource();
        String type = method.getReturnType().getName();
        boolean isVoid = "void".equals(type);

        StringBuilder builder = new StringBuilder(target);
        target = target.replace("\\s+", " ");
        boolean returnStatement =
                target.contains(" return ")
                        || target.contains("return ")
                        || target.contains(" return;")
                        || target.contains(";return;")
                        || target.contains(";return ")
                        || target.contains(" throw ")
                        || target.contains("throw ")
                        || target.contains(";throw ");
        if (isVoid) {
            if (!returnStatement) {
                builder.append("return;");
            }
        } else {
            if (!returnStatement) {
                throw new CannotCompileException(
                        "Catch block code fragment must end with a throw or return statement, " +
                                "but found: " + target);
            }
        }
        target = getReplaceStatement(clazz.getName(), method, builder.toString());
        srcMethod.addCatch(target, exceptionType);
    }
Transform that wraps method-execute with try-catch.
plugin/src/main/groovy/com/didichuxing/tools/droidassist/transform/enhance/MethodExecutionTryCatchTransformer.java