Compare commits

...
2 changed files with 20 additions and 20 deletions
+17 -4
View File
@@ -211,24 +211,37 @@ const AppContainer = () => {
enabled: true,
environment: VEGA_ENV,
release: GIT_COMMIT_HASH,
beforeSend(event) {
beforeSend(event, hint) {
const error = hint?.originalException;
const errorIsString = typeof error === 'string';
const errorIsObject = error instanceof Error;
const requestUrl = event.request?.url;
const transaction = event.transaction;
if (
(errorIsString && error.includes('failed to get party ID')) ||
(errorIsObject &&
error?.message?.includes('failed to get party ID'))
) {
// This error is caused by a pubkey making an API request before
// it has interacted with the chain. This isn't needed in Sentry.
return null;
}
const updatedRequest =
requestUrl && requestUrl.includes('/test?')
requestUrl && requestUrl.includes('/claim?')
? { ...event.request, url: removeQueryParams(requestUrl) }
: event.request;
const updatedTransaction =
transaction && transaction.includes('/test?')
transaction && transaction.includes('/claim?')
? removeQueryParams(transaction)
: transaction;
const updatedBreadcrumbs = event.breadcrumbs?.map((breadcrumb) => {
if (
breadcrumb.type === 'navigation' &&
breadcrumb.data?.to?.includes('/test?')
breadcrumb.data?.to?.includes('/claim?')
) {
return {
...breadcrumb,
@@ -1,4 +1,3 @@
import { useEffect, useState } from 'react';
import { ENV } from '../../../config';
import { Callout, Intent, Splash } from '@vegaprotocol/ui-toolkit';
import { useVegaWallet } from '@vegaprotocol/wallet';
@@ -39,21 +38,9 @@ export const NodeContainer = ({
}
: undefined,
},
errorPolicy: 'all',
});
const [isRefetching, setIsRefetching] = useState(false);
useEffect(() => {
if (error && error.message.includes('failed to get party for ID')) {
setIsRefetching(true);
// The API errors if there is a pubkey, but it hasn't interacted with the
// chain before. In that case, retry the query with empty pubKey
refetch({
partyId: '',
}).finally(() => setIsRefetching(false));
}
}, [error, refetch, delegationsPagination]);
const { data: previousEpochData } = usePreviousEpochQuery({
variables: {
epochId: (Number(data?.epoch.id) - 1).toString(),
@@ -63,7 +50,7 @@ export const NodeContainer = ({
useRefreshAfterEpoch(data?.epoch.timestamps.expiry, refetch);
if (error && !isRefetching) {
if (error && !error.message.includes('failed to get party for ID')) {
return (
<Callout intent={Intent.Danger} title={t('Something went wrong')}>
<pre>
@@ -75,7 +62,7 @@ export const NodeContainer = ({
);
}
if (loading || isRefetching) {
if (loading) {
return (
<Splash>
<SplashLoader />