/*
(non-Javadoc)

@see net.sf.flatpack.DataSet#isAnError(int)
974291
@Override
    public boolean isAnError(final int lineNo) {
        for (int i = 0; i < errors.size(); i++) {
            if (errors.get(i).getLineNo() == lineNo && errors.get(i).getErrorLevel() > 1) {
                return true;
            }
        }
        return false;
    }
1149409
public void internalError(final Exception cause) {
    logError("Internal Server Error on " + request().getUri(), cause);
    sendBuffer(HttpResponseStatus.INTERNAL_SERVER_ERROR,
        ChannelBuffers.wrappedBuffer(
            cause.toString().getBytes(Const.UTF8_CHARSET)),
        "text/plain");
  }
1335743
func IsError(code string, err error) bool {
	if err, ok := err.(*Error); ok {
		return err.Code == code
	}
	return false
}
895709
public boolean isClientError(IOException e) {
    GoogleJsonResponseException jsonException = getJsonResponseExceptionOrNull(e);
    if (jsonException != null) {
      return (getHttpStatusCode(jsonException)) / 100 == 4;
    }
    return false;
  }
507610
private void errorIf(ClientResponse response,
            ClientResponse.Status[] status, boolean bool)
            throws ClientException {
        ClientResponse.Status clientResponseStatus
                = response.getClientResponseStatus();
        if (bool) {
            if (contains(status, clientResponseStatus)) {
                String message = response.getEntity(String.class);
                throw new ClientException(clientResponseStatus, message);
            }
        } else if (!contains(status, clientResponseStatus)) {
            String message = response.getEntity(String.class);
            throw new ClientException(clientResponseStatus, message);
        }
    }
699780
private void checkError() throws IOException {
		final Throwable t = channelError.get();

		if (t != null) {
			if (t instanceof IOException) {
				throw (IOException) t;
			} else {
				throw new IOException("There has been an error in the channel.", t);
			}
		}
	}
1064614
@Override
    public void error(Throwable t) {
        log.log(Level.SEVERE, t.getMessage(), t);
    }
402333
private void checkForError(JsonNode resp) throws WePayException
	{
		JsonNode errorNode = resp.get("error");
		if (errorNode != null)
			throw new WePayException(errorNode.asText(), resp.path("error_description").asText(), resp.path("error_code").asInt());
	}
783952
protected void setError(int newPosition, String error,
      boolean currentExisting) {
    if (!currentExisting) {
      newBasicValueSumList[newPosition] = operations.getZero1();
      newBasicValueNList[newPosition] = 0;
    }
    newErrorNumber[newPosition]++;
    if (newErrorList[newPosition].containsKey(error)) {
      newErrorList[newPosition].put(error,
          newErrorList[newPosition].get(error) + 1);
    } else {
      newErrorList[newPosition].put(error, 1);
    }
  }
365519
public static void error(Object errMsg, Throwable t) {
        if (level.ordinal() >= Level.ERROR.ordinal())
            singleton.error(errMsg, t, loggerName());
    }
160406
public boolean error(final Object socketOrChannel)
    {
        final PollItem it = filter(socketOrChannel, ERR);
        if (it == null) {
            return false;
        }
        return it.isError();
    }
163619
@com.fasterxml.jackson.annotation.JsonProperty("error")
    public void setError(StorageGatewayError error) {
        this.error = error;
    }
715283
@SuppressWarnings({"ThrowableInstanceNeverThrown"})
    public static void validatePrimitiveArray(Method method, Class type, List<Throwable> errors)
    {
        Class returnType = method.getReturnType();
        if (!returnType.isArray() || !returnType.getComponentType().equals(type))
        {
            errors.add(new Exception("Method " + method.getName() + "() should return " + type.getName() + "[]"));
        }
    }
840142
public void sendError( ServletRequest request, ServletResponse response )
        throws IOException
    {
        InternalUtils.sendError( _messageKeyPrefix, getMessageArgs(), request, response, null,
                                 InternalUtils.avoidDirectResponseOutput( request ) );
    }
761182
@Override
  public void registerErrorHandler(final EventHandler<Exception> handler) {
    this.clientEventListener.registerErrorHandler(handler);
    this.serverEventListener.registerErrorHandler(handler);
  }
673005
void error(int e) {
        String s = "Error " + e + " at line " + fLineNum + " column "
                + fCharNum;
        IllegalArgumentException ex = new IllegalArgumentException(s);
        throw ex;

    }
197755
@Override
    public void isValid() throws Exception {
        if (numStmnts() >= 2) {
            if (primaryJoinableHooks.size() > 0) {
                for (String joinField:primaryJoinableHooks) {
                    if (joinField.equals("timestamp")) {// timestamp is implicitly present in the result.
                        continue;
                    }
                    for (QueryMeta query: getAllStmnts()) {
                        boolean isPresent = false;
                        if (query instanceof BaseAggQueryMeta) {// Since BaseAggQueryMeta is also a PlainDimQueryMeta we go with former first.
                            for (AggItem item:((BaseAggQueryMeta)query).aggregations) {
                                if (joinField.equals(item.fieldName) || (item.asName != null && joinField.equals(item.asName))) {
                                    isPresent = true;
                                }
                            }
                        }
                        if (query instanceof PlainDimQueryMeta) {
                            Map<String, String> dims = ((PlainDimQueryMeta)query).fetchDimensions;
                            for (Map.Entry<String, String> entry :dims.entrySet()) {
                                if (joinField.equals(entry.getKey()) || (entry.getValue() != null && joinField.equals(entry.getValue()))) {
                                    isPresent = true;
                                }
                            }
                        }
                        if (!isPresent) {
                            String error = joinField + " mentioned in the composite key should appear in all the data sources being queried and joined.";
                            throw new Exception(error);
                        }
                    }
                }
            } else {
                String error = "Need atleast one field to join on";
                throw new Exception(error);
            }
        }
    }