Skip to content

Commit 66ec7b3

Browse files
HHHindawyHossam Hindawyesezen
authored
[CSL-2973] Capture network errors from js-client (#100)
Co-authored-by: Hossam Hindawy <hossam.hindawy@hossam.hindawy-Q7M9F6QK6G> Co-authored-by: Enes Kutay SEZEN <eneskutaysezen@gmail.com>
1 parent bdb730d commit 66ec7b3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,15 @@ export const disableStoryActions = (story) => {
125125

126126
export const getCioClient = (apiKey?: string) => {
127127
if (apiKey) {
128-
return new ConstructorIOClient({
128+
const cioClient = new ConstructorIOClient({
129129
apiKey,
130130
sendTrackingEvents: true,
131131
version: `cio-ui-autocomplete-${version}`,
132132
});
133+
134+
// eslint-disable-next-line no-console
135+
cioClient.tracker.on('error', (error) => console.error(error));
136+
return cioClient;
133137
}
134138

135139
return null;

0 commit comments

Comments
 (0)