How to customize the error message displayed

Feature(s) impacted

I’m using the cloud version of forest admin
I want to override the create function of a collection to call my backend which handle the business logic
So I called the collection.overrideCreate function
But when my API sends a validation error I can’t display the response in the frontend (see screenshot)

I tried to throw a BusinessError with a custom message from the @forestadmin/datasource-toolkit package but I still get the default error message.

I saw that I could use [customizeErrorMessage](https://docs.forestadmin.com/developer-guide-agents-nodejs/getting-started/install/create-your-agent#customizeerrormessage-function-defaults-to-null) with self hosted version.
But I don’t know how to do it with the cloud version because we don’t call createAgent

Is it possible to display a custom message ?

Observed behavior

I get the default message

Expected behavior

I can customize the error message in overrideCreate function

Failure Logs

Context

  • Project name: Azybia
  • Team name: Azybia
  • Environment name: production
  • Agent technology: nodejs (cloud)
  • Agent (forest package) “@forestadmin/forest-cloud”: “1.9.17”
  • Database type: postgres
  • Recent changes made on your end if any: N/A

Hi @Quentin_Somerville1 ,

Your issue comes from a bug that we identified from your feedback. There seem to be no workaround for now, but we are currently working on the fix. It should be available in the following days. I’ll let you know.

kind regards

1 Like

Hello @Quentin_Somerville1 ,

The fix is live, you should be able to see custom error messages from your agent in your browser.

1 Like

Thank you @Enki I just tried and it works