@Override public void rethrowAsCore() throws CoreException { if (hasErrors()) { if (recorded.size() == 1) { throw ExceptionUtil.coreException(recorded.get(0)); } else { StringBuffer msg = new StringBuffer("Multiple problems: \n"); IStatus[] children = new IStatus[recorded.size()]; int i = 0; for (IStatus e : recorded) { if (i < 3) { msg.append(e.getMessage() + "\n"); } else if (i == 3) { msg.append("...more errors..."); } children[i++] = e; } IStatus status = new MultiStatus(GradleCore.PLUGIN_ID, 666, children, msg.toString(), null); throw new CoreException(status); } } else if (recorded.size() > 0) { // no errors but has some recorded stuff. Log this stuff to the error log rather than simply // discarding it. for (IStatus e : recorded) { GradleCore.log(e); } } }
public void rethrowAsCore() throws CoreException { if (hasErrors()) { throw ExceptionUtil.coreException(firstError); } }