mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 01:15:28 +00:00
fix: catch errors from redux migration
This commit is contained in:
@@ -27,21 +27,25 @@ interface Props {
|
||||
|
||||
const ERROR_URL = "https://reporting.revolt.chat";
|
||||
|
||||
export function reportError(error: Error, section: string) {
|
||||
stackTrace.fromError(error).then((stackframes) =>
|
||||
axios.post(ERROR_URL, {
|
||||
stackframes,
|
||||
rawStackTrace: error.stack,
|
||||
origin: window.origin,
|
||||
commitSHA: GIT_REVISION,
|
||||
userAgent: navigator.userAgent,
|
||||
section,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
export default function ErrorBoundary({ children, section }: Props) {
|
||||
const [error, ignoreError] = useErrorBoundary();
|
||||
|
||||
useEffect(() => {
|
||||
if (error) {
|
||||
stackTrace.fromError(error).then((stackframes) =>
|
||||
axios.post(ERROR_URL, {
|
||||
stackframes,
|
||||
rawStackTrace: error.stack,
|
||||
origin: window.origin,
|
||||
commitSHA: GIT_REVISION,
|
||||
userAgent: navigator.userAgent,
|
||||
section,
|
||||
}),
|
||||
);
|
||||
reportError(error, section);
|
||||
}
|
||||
}, [error]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user