Document doc = builder.build(new InputStreamReader(_input));
if (doc.getRootElement().getName().equals("error")) {
StringWriter writer = new StringWriter();
XMLOutputter output = new XMLOutputter(Format.getCompactFormat());
output.output(doc, writer);
Error error = (Error) Unmarshaller.unmarshal(Error.class,
new StringReader(writer.toString()));
if (LOG.isDebugEnabled()) {
LOG.debug("Error: [" + writer.toString() + "]");
}
throw new APIException("Error returned from Google.", error);