fix: Update JS SDK log messages for clarity (#5819)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Matti Nannt <mail@matti.sh>
This commit is contained in:
devin-ai-integration[bot]
2025-05-26 15:27:37 +05:30
committed by GitHub
parent 87870919ca
commit 45d74f9ba0

View File

@@ -193,6 +193,7 @@ export const setup = async (
if (environmentStateResponse.ok) {
environmentState = environmentStateResponse.data;
logger.debug(`Fetched ${environmentState.data.surveys.length.toString()} surveys from the backend`);
} else {
logger.error(
`Error fetching environment state: ${environmentStateResponse.error.code} - ${environmentStateResponse.error.responseMessage ?? ""}`
@@ -257,7 +258,7 @@ export const setup = async (
});
const surveyNames = filteredSurveys.map((s) => s.name);
logger.debug(`Fetched ${surveyNames.length.toString()} surveys during sync: ${surveyNames.join(", ")}`);
logger.debug(`${surveyNames.length.toString()} surveys could be shown to current user on trigger: ${surveyNames.join(", ")}`);
} catch {
logger.debug("Error during sync. Please try again.");
}
@@ -303,6 +304,7 @@ export const setup = async (
}
const environmentState = environmentStateResponse.data;
logger.debug(`Fetched ${environmentState.data.surveys.length.toString()} surveys from the backend`);
const filteredSurveys = filterSurveys(environmentState, userState);
config.update({
@@ -312,6 +314,9 @@ export const setup = async (
environment: environmentState,
filteredSurveys,
});
const surveyNames = filteredSurveys.map((s) => s.name);
logger.debug(`${surveyNames.length.toString()} surveys could be shown to current user on trigger: ${surveyNames.join(", ")}`);
} catch (e) {
await handleErrorOnFirstSetup(e as { code: string; responseMessage: string });
}