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