Skip to content

Commit a85395e

Browse files
chore: ignore audio abort errors in sentry
1 parent 94a6fd7 commit a85395e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/components/audio-player.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from "@chakra-ui/react";
1212
import { useEffect, useRef, useState } from "react";
1313
import { FullQuestion } from "../utils/types";
14-
import { startSpan } from "@sentry/react";
14+
import { logger, startSpan } from "@sentry/react";
1515

1616
interface AudioPlayerProps {
1717
fullQuestion: FullQuestion;
@@ -98,7 +98,13 @@ export function AudioPlayer({ fullQuestion }: AudioPlayerProps) {
9898
audioRef.current?.pause();
9999
} else {
100100
startSpan({ name: "AudioPlayer: play audio" }, async () => {
101-
await audioRef.current?.play();
101+
try {
102+
await audioRef.current?.play();
103+
} catch (e) {
104+
if (e instanceof Error && e.name !== "AbortError") {
105+
logger.warn(e.message);
106+
}
107+
}
102108
});
103109
}
104110
};

0 commit comments

Comments
 (0)