Skip to content

Commit

Permalink
Implement error help text
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-z committed Jul 15, 2024
1 parent 5f8596c commit b6e0e48
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/healthchecksio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ export function HealthchecksioStatus({ showInternal, initialGroupKey = "" }: { s
const checks = (processHCData(dataRaw) || []).filter(check => check.tags_dict.public !== 'False' || showInternal).sort((a, b) => a.name.localeCompare(b.name));
const groupedChecks = groupBy(checks, c => c.tags_dict[groupKey]);

const errorHelp = "Please see the console for more information.";

return (
<div className="my-4">
{isLoading && <p className='text-gray-500'>Loading...</p>}
{error && <p className='text-red-500'>Error: {error.message}</p>}
{error && <p className='text-red-500'>Error: {error.message}. {errorHelp}</p>}
{checks && checks.length > 0 && (
<>
<StatusSummary statuses={checks.map(check => getStatus(check.status))} symbolClassName="text-xl" className="mb-4" />
Expand Down
4 changes: 3 additions & 1 deletion src/sentry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ export function SentryStatus() {
monitors.sort((a: any, b: any) => a.name.localeCompare(b.name));
}

const errorHelp = error?.toString() == "TypeError: Failed to fetch" ? "Is the request blocked by an adblocker?" : "Please see the console for more information.";

return (
<div className="my-4">
{isLoading && <p className='text-gray-500'>Loading...</p>}
{error && <p className='text-red-500'>Error: {error.message}</p>}
{error && <p className='text-red-500'>Error: {error.message}. {errorHelp}</p>}
{monitors && monitors.length > 0 && (
<>
<StatusSummary statuses={monitors.flatMap((monitor: any) => monitor.environments?.map((environment: any) => getStatus(environment.status)))} symbolClassName="text-xl" className="mb-4" />
Expand Down

0 comments on commit b6e0e48

Please sign in to comment.