add path to errorboundary
This commit is contained in:
parent
f01a27fcea
commit
5129bf722c
|
@ -1,23 +1,33 @@
|
||||||
import React from 'react'
|
import React, { useCallback } from 'react'
|
||||||
import { FiveOhFive } from './FiveOhFive'
|
import { FiveOhFive } from './FiveOhFive'
|
||||||
import * as Sentry from '@sentry/react'
|
import * as Sentry from '@sentry/react'
|
||||||
|
import { useRouter } from 'next/router'
|
||||||
|
|
||||||
const ErrorBoundary: React.FC<any> = (props) => {
|
const ErrorBoundary: React.FC<any> = (props) => {
|
||||||
const postError = (error, componentStack) => {
|
const { asPath } = useRouter()
|
||||||
if (process.env.NEXT_PUBLIC_ERROR_WEBHOOK_URL) {
|
|
||||||
try {
|
const postError = useCallback(
|
||||||
fetch(process.env.NEXT_PUBLIC_ERROR_WEBHOOK_URL, {
|
(error, componentStack) => {
|
||||||
method: 'POST',
|
if (process.env.NEXT_PUBLIC_ERROR_WEBHOOK_URL) {
|
||||||
headers: { 'Content-Type': 'application/json' },
|
try {
|
||||||
body: JSON.stringify({
|
fetch(process.env.NEXT_PUBLIC_ERROR_WEBHOOK_URL, {
|
||||||
content: `UI ERROR: ${error} : ${componentStack}`.slice(0, 1999),
|
method: 'POST',
|
||||||
}),
|
headers: { 'Content-Type': 'application/json' },
|
||||||
})
|
body: JSON.stringify({
|
||||||
} catch (err) {
|
content:
|
||||||
console.error('Error posting to notify webhook:', err)
|
`UI ERROR: (${asPath}) ${error} : ${componentStack}`.slice(
|
||||||
|
0,
|
||||||
|
1999
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error posting to notify webhook:', err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
[asPath]
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Sentry.ErrorBoundary
|
<Sentry.ErrorBoundary
|
||||||
|
|
|
@ -108,7 +108,7 @@ let mangoAccountRetryAttempt = 0
|
||||||
const initMangoClient = (connection: Connection): MangoClient => {
|
const initMangoClient = (connection: Connection): MangoClient => {
|
||||||
return new MangoClient(connection, programId, {
|
return new MangoClient(connection, programId, {
|
||||||
timeout: CLIENT_TX_TIMEOUT,
|
timeout: CLIENT_TX_TIMEOUT,
|
||||||
prioritizationFee: 10000,
|
prioritizationFee: 5000,
|
||||||
postSendTxCallback: ({ txid }: { txid: string }) => {
|
postSendTxCallback: ({ txid }: { txid: string }) => {
|
||||||
notify({
|
notify({
|
||||||
title: 'Transaction sent',
|
title: 'Transaction sent',
|
||||||
|
|
Loading…
Reference in New Issue