Skip to content

Commit f54dd3b

Browse files
Zio-4zwatson2001
andauthored
Adding custom Sentry error for writing trails. (#393)
Co-authored-by: Zach Watson <156386417+zwatson2001@users.noreply.github.com>
1 parent cd4a456 commit f54dd3b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

task-launcher/src/tasks/shared/helpers/trialSaving.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import cloneDeep from 'lodash/cloneDeep';
33
import _mapValues from 'lodash/mapValues';
44
import { taskStore } from '../../../taskStore';
55
import { recordCompletion } from './recordCompletion';
6+
import { Logger } from '../../../utils/logger';
67
import { finishExperiment } from '../trials';
78

89
/**
@@ -172,7 +173,10 @@ export const initTrialSaving = (config: Record<string, any>) => {
172173
if (config.isRoarApp) {
173174
config.firekit.writeTrial(dataCopy, computedScoreCallback);
174175
} else {
175-
config.firekit.writeTrial(dataCopy);
176+
config.firekit.writeTrial(dataCopy).catch((error: any) => {
177+
delete dataCopy.stimulus; // remove stimulus from data to avoid logging large html elements
178+
Logger.getInstance().capture('Error writing trial to Firestore', { error: error, data: dataCopy });
179+
});
176180
}
177181
}
178182
});

0 commit comments

Comments
 (0)