Customizing Error Messages in Foundry

I’m trying to change the system-generated ‘Failed to apply edits’ message to ‘Error’ in the Front-end. Is there a way to customize such error messages in Foundry?

No, there is no way for end-users to customise error messages served from core product services

1 Like

Although you can’t change the “Failed to apply edits” message, if your action is backed by a function, you can customize the error message using something similar to the code below!

   import { Edits, OntologyEditFunction, UserFacingError } from "@foundry/functions-api";
   import { Employee } from "@foundry/ontology-api";

   @Edits(Employee)
   @OntologyEditFunction()
   public editExactlyFiveEmployees(employees: Employee[]): void {
       if (employees.length != 5) {
           throw new UserFacingError(`Pass in exactly 5 employees. Received ${employees.length}.`);
       }
       ...
   }

This would give you an error message that looks like this.

More information on this can be found in our documentation!

1 Like