mirror of
https://github.com/langgenius/dify.git
synced 2026-09-08 11:04:27 +08:00
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:
parent
a2bf4c397b
commit
ee60f5dd29
@ -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: {
|
||||
|
||||
@ -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[] =
|
||||
|
||||
Loading…
Reference in New Issue
Block a user