add path to errorboundary

This commit is contained in:
tjs 2022-09-16 18:21:08 -04:00
parent f01a27fcea
commit 5129bf722c
2 changed files with 26 additions and 16 deletions

View File

@ -1,23 +1,33 @@
import React from 'react'
import React, { useCallback } from 'react'
import { FiveOhFive } from './FiveOhFive'
import * as Sentry from '@sentry/react'
import { useRouter } from 'next/router'
const ErrorBoundary: React.FC<any> = (props) => {
const postError = (error, componentStack) => {
if (process.env.NEXT_PUBLIC_ERROR_WEBHOOK_URL) {
try {
fetch(process.env.NEXT_PUBLIC_ERROR_WEBHOOK_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
content: `UI ERROR: ${error} : ${componentStack}`.slice(0, 1999),
}),
})
} catch (err) {
console.error('Error posting to notify webhook:', err)
const { asPath } = useRouter()
const postError = useCallback(
(error, componentStack) => {
if (process.env.NEXT_PUBLIC_ERROR_WEBHOOK_URL) {
try {
fetch(process.env.NEXT_PUBLIC_ERROR_WEBHOOK_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
content:
`UI ERROR: (${asPath}) ${error} : ${componentStack}`.slice(
0,
1999
),
}),
})
} catch (err) {
console.error('Error posting to notify webhook:', err)
}
}
}
}
},
[asPath]
)
return (
<Sentry.ErrorBoundary

View File

@ -108,7 +108,7 @@ let mangoAccountRetryAttempt = 0
const initMangoClient = (connection: Connection): MangoClient => {
return new MangoClient(connection, programId, {
timeout: CLIENT_TX_TIMEOUT,
prioritizationFee: 10000,
prioritizationFee: 5000,
postSendTxCallback: ({ txid }: { txid: string }) => {
notify({
title: 'Transaction sent',