Cannot customize the error message on password change with custom database connections

I’m using custom database connections with “Change Password” database action script like this:

function changePassword(email, newPassword, callback) {
  // initialize my client ...
  
  someClient.changePassword(someParams)
    .then((res) => {
      // success!
      callback(null, true);
    })
    .catch((e) => {
      // failed!
      callback(new Error("Something wrong!"));
    });
}

When the password change fails for some reason (ex: too weak password), we want to show the custom error message “Something wrong!”, but got “There was an error processing the password reset.” instead.
How can we achieve this?

We’re also using a custom db with a change password script and would like to provide more user feedback when they are changing their password. In our specific case, we check against previous password hashes to make sure the user isn’t reusing a password, but we can’t provide actionable feedback to the user via the script. They always see “Something went wrong, please try again later” instead of a message specific to the problem with their password (strength, reuse, or any other custom check we have in place).