# Google Data APIs Client Library (1.43.0)

## com.google.api.gbase.client
Class ServiceError

    java.lang.Object
      com.google.api.gbase.client.ServiceError

    public class ServiceError

extends java.lang.Object

One error found in the body of a `ServiceException` or in the content of a `BatchStatus`.

See Also:
  `ServiceErrors`

Field Summary
`static java.lang.String` `DATA_TYPE` The "data" error type.
`static java.lang.String` `REQUEST_TYPE` The "request" error type.

Constructor Summary
`ServiceError(java.lang.String reason)` Creates a new error with just an error message.
`ServiceError(java.lang.String type, java.lang.String field, java.lang.String reason)` Creates a new error.

Method Summary
`java.lang.String` `getField()` Gets the error field.
`java.lang.String` `getReason()` Gets the error message (plain text).
`java.lang.String` `getType()` Gets the error type.
`java.lang.String` `toString()` Returns a convenient string representation.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### DATA_TYPE

    public static final java.lang.String DATA_TYPE

  The "data" error type.

  See Also:
    Constant Field Values

### REQUEST_TYPE

    public static final java.lang.String REQUEST_TYPE

  The "request" error type.

  See Also:
    Constant Field Values

Constructor Detail

### ServiceError

    public ServiceError(java.lang.String type,
                        java.lang.String field,
                        java.lang.String reason)

  Creates a new error.

  Parameters:
    `type` - error type, may be null, `DATA_TYPE` or `REQUEST_TYPE`
    `field` - error field, may be null
    `reason` - error message

### ServiceError

    public ServiceError(java.lang.String reason)

  Creates a new error with just an error message.

  Parameters:
    `reason` - error message

Method Detail

### toString

    public java.lang.String toString()

  Returns a convenient string representation.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a string representation

### getType

    public java.lang.String getType()

  Gets the error type.

  Returns:
    error type or null

### getField

    public java.lang.String getField()

  Gets the error field.

  Returns:
    error field or null

### getReason

    public java.lang.String getReason()

  Gets the error message (plain text).

  Returns:
    error message