Skip to content

Commit 2747ebb

Browse files
committed
fix(sketcher): capture errors and send to sentry
1 parent dea6003 commit 2747ebb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

components/Sketcher.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useEffect } from "react";
22

3+
import { captureException } from "@sentry/nextjs";
34
import type { Ketcher } from "ketcher-core";
45
import { Editor } from "ketcher-react";
56
import { StandaloneStructServiceProvider } from "ketcher-standalone";
@@ -96,7 +97,12 @@ export const Sketcher = ({ smiles, onUnmount }: SketcherProps) => {
9697
buttons={Object.fromEntries(
9798
Object.entries(allButtons).map(([name, hidden]) => [name, { hidden }]),
9899
)}
99-
errorHandler={(message) => message && enqueueError(message)}
100+
errorHandler={(message) => {
101+
if (message) {
102+
captureException(message);
103+
enqueueError(message);
104+
}
105+
}}
100106
staticResourcesUrl="./" // TODO: Config for subpaths
101107
structServiceProvider={new StandaloneStructServiceProvider()}
102108
onInit={(ketcher: Ketcher) => {

0 commit comments

Comments
 (0)