---
schema_version: "1"
id: 4fd64a23735f642e9f9336fcf823a9f13a769c24860bdaaaf87932aa9dc95cc2
title: Interface DataApiError
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforce-functions/functions/guide/javasdk/interfaces/java-dataapierror.md
canonical_url: https://developer.salesforce.com/docs/platform/functions/guide/java-dataapierror.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 38bd29e56d589dd692852329b06134ca97b72a23a8bb79831ed4a6656a27fcca
products:
  - Salesforce Functions
---
# Interface DataApiError

------------------------------------------------------------------------

\@Immutable public interface DataApiError

Represents an error from the Data API. Contains detailed information
about the underlying error.

All implementations must be immutable and therefore thread-safe.

See Also: [REST API Developer Guide - Status Codes and Error Responses](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/errorcodes.htm)

## Method Summary

| Modifier and Type                  | Method           | Description                                       |
| ---------------------------------- | ---------------- | ------------------------------------------------- |
| `java.lang.String`                 | `getErrorCode()` | Returns the error code for this error.            |
| `java.util.List<java.lang.String>` | `getFields()`    | Returns the field names where the error occurred. |
| `java.lang.String`                 | `getMessage()`   | Returns the message of this error.                |

## Method Details

### getMessage

\@Nonnull java.lang.String getMessage()

Returns the message of this error.

Returns: The message of this error.

### getErrorCode

\@Nonnull java.lang.String getErrorCode()

Returns the error code for this error.

Returns: The error code for this error.

### getFields

\@Nonnull java.util.List\<java.lang.String\> getFields()

Returns the field names where the error occurred. Might be empty for
errors that are not related to a specific field.

Returns: The field names where the error occurred.
