MCPcopy Create free account
hub / github.com/9d8dev/next-wp / wordpressFetchGraceful

Function wordpressFetchGraceful

lib/wordpress.ts:79–93  ·  view source on GitHub ↗
(
  path: string,
  fallback: T,
  query?: Record<string, any>,
  tags: string[] = ["wordpress"]
)

Source from the content-addressed store, hash-verified

77
78// Graceful fetch - returns fallback when WordPress unavailable or on error
79async function wordpressFetchGraceful<T>(
80 path: string,
81 fallback: T,
82 query?: Record<string, any>,
83 tags: string[] = ["wordpress"]
84): Promise<T> {
85 if (!isConfigured) return fallback;
86
87 try {
88 return await wordpressFetch<T>(path, query, tags);
89 } catch {
90 console.warn(`WordPress fetch failed for ${path}`);
91 return fallback;
92 }
93}
94
95// Paginated fetch - returns response with headers
96async function wordpressFetchPaginated<T>(

Callers 8

getAllPostsFunction · 0.85
getAllCategoriesFunction · 0.85
getAllTagsFunction · 0.85
getAllPagesFunction · 0.85
getAllAuthorsFunction · 0.85
searchCategoriesFunction · 0.85
searchTagsFunction · 0.85
searchAuthorsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected