fix(web): surface creator profile API errors instead of 404

A timed-out or 500 publisher request was mapped to notFound(). Only a
successful empty creator response should 404; transport failures should
reach the route error boundary.
This commit is contained in:
CodingOnStar 2026-08-31 22:56:14 +08:00
parent a2bf4c397b
commit ee60f5dd29
2 changed files with 22 additions and 1 deletions

View File

@ -183,6 +183,26 @@ describe('loadCreatorProfile', () => {
).resolves.toBeNull()
})
it('rethrows when the primary creator request fails', async () => {
mocks.creatorDetail.mockRejectedValue(new Error('creator request timed out'))
await expect(
loadCreatorProfile({ uniqueHandle: 'slow-creator', locale: 'en-US' }),
).rejects.toThrow('creator request timed out')
})
it('rethrows when the organization request fails', async () => {
mocks.organizationDetail.mockRejectedValue(new Error('organization request timed out'))
await expect(
loadCreatorProfile({
uniqueHandle: 'slow-org',
publisherType: 'organization',
locale: 'en-US',
}),
).rejects.toThrow('organization request timed out')
})
it('maps organizations to the shared creator profile shape', async () => {
mocks.organizationDetail.mockResolvedValue({
data: {

View File

@ -104,7 +104,8 @@ const loadCreatorProfileCached = cache(
getPublisherTemplates(uniqueHandle, sortField, sortOrder),
])
const creator = creatorResult.status === 'fulfilled' ? creatorResult.value : undefined
if (creatorResult.status === 'rejected') throw creatorResult.reason
const creator = creatorResult.value
if (!creator) return null
const plugins: MarketplacePlugin[] =