[Fleet] EPM - Fix error message for data stream settings update (#210330)

## Summary

During package installation, failure to update the default pipeline for
data streams currently has a misleading error message. This PR corrects
this and adds the original error message to improve clarity.

### Identify risks

N/A

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Jill Guyonnet 2025-02-11 12:25:13 +01:00 committed by GitHub
parent d26f9ffbb6
commit 2f4fb3ff2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1212,7 +1212,7 @@ const updateExistingDataStream = async ({
}
try {
logger.debug(`Updating settings for ${dataStreamName}`);
logger.debug(`Updating index settings of data stream ${dataStreamName}`);
await retryTransientEsErrors(
() =>
@ -1223,8 +1223,11 @@ const updateExistingDataStream = async ({
{ logger }
);
} catch (err) {
logger.error(`Error updating index settings of data stream ${dataStreamName}: ${err}`);
// Same as above - Check if this error can happen because of invalid settings;
// We are returning a 500 but in that case it should be a 400 instead
throw new PackageESError(`Could not update index template settings for ${dataStreamName}`);
throw new PackageESError(
`Could not update index settings of data stream ${dataStreamName}: ${err.message}`
);
}
};