# User-facing errors When running functions in other parts of the platform, such as Workshop or actions, you may want to throw an error with a detailed message. To do so, throw a `UserFacingError`. For example: ```typescript tab="TypeScript v1" import { Function, UserFacingError } from "@foundry/functions-api"; import { Employee } from "@foundry/ontology-api"; export class MyFunctions { @Function() public async searchExactlyFiveEmployees(employees: Employee[]): Proimse { if (employees.length != 5) { throw new UserFacingError(`Pass in exactly 5 employees. Received ${employees.length}.`); } // search employees } } ``` ```typescript tab="TypeScript v2" import { Osdk } from "@osdk/client"; import { Employee } from "@ontology/sdk"; import { UserFacingError } from "@osdk/functions"; export default async function searchExactlyFiveEmployees(employees: Array>): Promise { if (employees.length != 5) { throw new UserFacingError(`Pass in exactly 5 employees. Received ${employees.length}.`); } // search employees } ``` ```python tab="Python" from functions.api import function, UserFacingError from ontology_sdk import FoundryClient from ontology_sdk.ontology.objects import Aircraft @function() def search_exactly_five_employees( employees: list[Aircraft] ) -> str: if not len(aircraft) == 5: raise UserFacingError(f"Pass in exactly 5 employees. Received ${len(aircraft)}.") # search employees ``` When running this as a [Function-backed Action](../../action-types/function-actions-overview/index.md) in a [Workshop application](../../workshop/functions-use/index.md) with an incorrect number of employees, users will see the following error: ![user-facing-error](../../../assets/86521eda7253ed574f8321bebf7cd950cb41acdf659c8093e0d69919cb2d9b96.webp) When a function used in a [function-backed export](../../workshop/widgets-button-group/index.md#function-backed-export) throws a `UserFacingError`, the export failure toast displays the error message. A detailed user-facing error message helps users identify and resolve the issue.