Search handles errors with user-facing message, not raw error or empty list
Why it matters
A blank page or raw stack trace on a search error tells users nothing actionable and exposes internal implementation details — error messages containing TypeError: Cannot read property of undefined or Prisma stack traces reveal your ORM, schema, and query structure. Under ISO 25010:2011 reliability, an application that silently drops into an empty state on network failure or backend error leaves users unable to distinguish "no results" from "broken search" — and they'll assume the latter, blame the product, and leave.
Severity rationale
Medium because the failure degrades user trust and leaks implementation details without constituting a direct data breach or service outage.
Remediation
Wrap the search fetch in try/catch and render a non-technical error message when the request fails. In components/SearchInput.tsx:
try {
const res = await fetch(`/api/listings?q=${encodeURIComponent(query)}`)
if (!res.ok) throw new Error('non-2xx')
const data = await res.json()
setResults(data.listings)
} catch {
setError('Search is temporarily unavailable. Please try again.')
}
// In render:
{error && (
<div role="alert" className="bg-red-50 border border-red-200 p-4 rounded">
{error}
</div>
)}
Log the original error to the server (not to the client). Never render err.message directly — it will contain stack traces or ORM internals.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Search & Discovery UX Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · reliability — Fault Tolerance — user-facing error recovery
Taxons
History
- 2026-04-18·v1.0.0·Initial import from directory-search-discovery·automated