String (GroovyRuntimeException exception) { if (exception.getCause() instanceof ClassNotFoundException) { String className = exception.getCause().getMessage(); return "An error occurred while trying to load a required class " + className + "." + " Please ensure it's present in the project dependencies. " + "See the message and the stack trace below for reference\n\n" + getStackTrace(exception); } String message = exception.getMessageWithoutLocationText(); return message == null ? getStackTrace(exception) : message; }