explorer: fix epoch page failure state (#21068)
This commit is contained in:
parent
a8d78e89d3
commit
78d99b89c0
|
@ -8,6 +8,7 @@ import { Epoch } from "components/common/Epoch";
|
||||||
import { Slot } from "components/common/Slot";
|
import { Slot } from "components/common/Slot";
|
||||||
import { useEpoch, useFetchEpoch } from "providers/epoch";
|
import { useEpoch, useFetchEpoch } from "providers/epoch";
|
||||||
import { displayTimestampUtc } from "utils/date";
|
import { displayTimestampUtc } from "utils/date";
|
||||||
|
import { FetchStatus } from "providers/cache";
|
||||||
|
|
||||||
type Props = { epoch: string };
|
type Props = { epoch: string };
|
||||||
export function EpochDetailsPage({ epoch }: Props) {
|
export function EpochDetailsPage({ epoch }: Props) {
|
||||||
|
@ -58,6 +59,9 @@ function EpochOverviewCard({ epoch }: OverviewProps) {
|
||||||
if (epoch > currentEpoch) {
|
if (epoch > currentEpoch) {
|
||||||
return <ErrorCard text={`Epoch ${epoch} hasn't started yet`} />;
|
return <ErrorCard text={`Epoch ${epoch} hasn't started yet`} />;
|
||||||
} else if (!epochState?.data) {
|
} else if (!epochState?.data) {
|
||||||
|
if (epochState?.status === FetchStatus.FetchFailed) {
|
||||||
|
return <ErrorCard text={`Failed to fetch details for epoch ${epoch}`} />;
|
||||||
|
}
|
||||||
return <LoadingCard message="Loading epoch" />;
|
return <LoadingCard message="Loading epoch" />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import * as Sentry from "@sentry/react";
|
|
||||||
import * as Cache from "providers/cache";
|
import * as Cache from "providers/cache";
|
||||||
import { Connection, EpochSchedule } from "@solana/web3.js";
|
import { Connection, EpochSchedule } from "@solana/web3.js";
|
||||||
import { useCluster, Cluster } from "./cluster";
|
import { useCluster, Cluster } from "./cluster";
|
||||||
|
import { reportError } from "utils/sentry";
|
||||||
|
|
||||||
export enum FetchStatus {
|
export enum FetchStatus {
|
||||||
Fetching,
|
Fetching,
|
||||||
|
@ -121,7 +121,7 @@ export async function fetchEpoch(
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
status = FetchStatus.FetchFailed;
|
status = FetchStatus.FetchFailed;
|
||||||
if (cluster !== Cluster.Custom) {
|
if (cluster !== Cluster.Custom) {
|
||||||
Sentry.captureException(err, { tags: { url } });
|
reportError(err, { epoch: epoch.toString() });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue