Skip to content

Commit 9026f1b

Browse files
Add Sentry error tracking to CopyForLLMButton component
Co-authored-by: rahul.chhabria <[email protected]>
1 parent ac1f6ee commit 9026f1b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/components/copyForLLMButton.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
'use client';
22

33
import {useState} from 'react';
4-
import {Clipboard, Check} from 'react-feather';
4+
import {Check,Clipboard} from 'react-feather';
5+
import * as Sentry from '@sentry/nextjs';
56

67
interface Props {
78
/** Absolute path to the markdown version of this page (e.g. `/docs/page.md`) */
@@ -24,7 +25,7 @@ export function CopyForLLMButton({markdownPath}: Props) {
2425
}
2526
} catch (err) {
2627
// network error handled below in fallback
27-
console.error(err);
28+
Sentry.captureException(err);
2829
}
2930

3031
// Fallback: copy the markdown URL if first attempt failed
@@ -33,7 +34,7 @@ export function CopyForLLMButton({markdownPath}: Props) {
3334
await navigator.clipboard.writeText(window.location.origin + markdownPath);
3435
didCopy = true;
3536
} catch (err) {
36-
console.error('Failed to copy markdown URL as fallback', err);
37+
Sentry.captureException(err);
3738
}
3839
}
3940

src/components/docPage/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import './type.scss';
1414
import {Banner} from '../banner';
1515
import {Breadcrumbs} from '../breadcrumbs';
1616
import {CodeContextProvider} from '../codeContext';
17+
import {CopyForLLMButton} from '../copyForLLMButton';
1718
import {DocFeedback} from '../docFeedback';
1819
import {GitHubCTA} from '../githubCTA';
1920
import {Header} from '../header';
@@ -23,7 +24,6 @@ import {PlatformSdkDetail} from '../platformSdkDetail';
2324
import {Sidebar} from '../sidebar';
2425
import {SidebarTableOfContents} from '../sidebarTableOfContents';
2526
import {ReaderDepthTracker} from '../track-reader-depth';
26-
import {CopyForLLMButton} from '../copyForLLMButton';
2727

2828
type Props = {
2929
children: ReactNode;

0 commit comments

Comments
 (0)