---
schema_version: "1"
id: c1132968283b030437875461349e7a12c9b71b87102da6f32c2b50b85858009e
title: FunctionInvocationError Interface
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_interface_functions_FunctionInvocationError.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_functions_FunctionInvocationError.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: ec1e3fdd1c8f857ef9e9c296e9ad482a602789d40a1cb71e0563009b4c7388c2
description: Use FunctionInvocationError to get detailed error information about a failed Function invocation.Returns the error message from a Function invocation error.Returns the error type for FunctionInvocationError.
---
# FunctionInvocationError Interface

Use FunctionInvocationError to get detailed error information about a failed Function invocation.

## Namespace

[functions](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_functions.htm "The Functions namespace provides classes and methods used to invoke and manage Salesforce Functions.")

## Usage

FunctionInvocationError contains various error information such as the error message at the time of the error.

- **[FunctionInvocationError Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_functions_FunctionInvocationError.htm#apex_functions_FunctionInvocationError_methods)**
- **[FunctionInvocationError Example Implementation](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_functions_FunctionInvocationError.htm#apex_interface_functions_FunctionInvocationError_Example)**

## FunctionInvocationError Methods

The following are methods for FunctionInvocationError.

- **[getMessage()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_functions_FunctionInvocationError.htm#apex_functions_FunctionInvocationError_getMessage)**  
    Returns the error message from a Function invocation error.
- **[getType()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_functions_FunctionInvocationError.htm#apex_functions_FunctionInvocationError_getType)**  
    Returns the error type for FunctionInvocationError.

### getMessage()

Returns the error message from a Function invocation error.

#### Signature

public String getMessage()

#### Return Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### getType()

Returns the error type for FunctionInvocationError.

#### Signature

public functions.FunctionErrorType getType()

#### Return Value

Type: [functions.FunctionErrorType](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_enum_functions_FunctionErrorType.htm "Represents the error type of FunctionInvocationError.")

## FunctionInvocationError Example Implementation

This is an example implementation of the functions.FunctionInvocationError interface.

public with sharing class MyFunctionInvocationError
  implements functions.FunctionInvocationError {
      public String getMessage() {
          return 'Mock error message for testing';
      }
      public functions.FunctionErrorType getType() {
          return functions.FunctionErrorType.FUNCTION\_EXCEPTION;
      }
}

This example tests the implementation.

functions.FunctionInvocationError testError = new MyFunctionInvocationError();
System.debug('Error: ' + testError.getMessage() + ' Type: ' + testError.getType());