mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 12:37:20 +08:00
refactor: update error handling to use DataSourceNodeErrorResponse in OnlineDocuments and WebsiteCrawl components
This commit is contained in:
parent
6030ae9d0f
commit
e66c2badda
@ -8,7 +8,7 @@ import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail'
|
|||||||
import { DatasourceType } from '@/models/pipeline'
|
import { DatasourceType } from '@/models/pipeline'
|
||||||
import { ssePost } from '@/service/base'
|
import { ssePost } from '@/service/base'
|
||||||
import Toast from '@/app/components/base/toast'
|
import Toast from '@/app/components/base/toast'
|
||||||
import type { DataSourceNodeCompletedResponse } from '@/types/pipeline'
|
import type { DataSourceNodeCompletedResponse, DataSourceNodeErrorResponse } from '@/types/pipeline'
|
||||||
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
||||||
import { useDataSourceStore, useDataSourceStoreWithSelector } from '../store'
|
import { useDataSourceStore, useDataSourceStoreWithSelector } from '../store'
|
||||||
|
|
||||||
@ -64,10 +64,10 @@ const OnlineDocuments = ({
|
|||||||
setDocumentsData(documentsData.data as DataSourceNotionWorkspace[])
|
setDocumentsData(documentsData.data as DataSourceNotionWorkspace[])
|
||||||
setCurrentWorkspaceId(documentsData.data[0].workspace_id)
|
setCurrentWorkspaceId(documentsData.data[0].workspace_id)
|
||||||
},
|
},
|
||||||
onError: (message: string) => {
|
onDataSourceNodeError: (error: DataSourceNodeErrorResponse) => {
|
||||||
Toast.notify({
|
Toast.notify({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message,
|
message: error.error,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import { DatasourceType } from '@/models/pipeline'
|
|||||||
import { ssePost } from '@/service/base'
|
import { ssePost } from '@/service/base'
|
||||||
import type {
|
import type {
|
||||||
DataSourceNodeCompletedResponse,
|
DataSourceNodeCompletedResponse,
|
||||||
|
DataSourceNodeErrorResponse,
|
||||||
DataSourceNodeProcessingResponse,
|
DataSourceNodeProcessingResponse,
|
||||||
} from '@/types/pipeline'
|
} from '@/types/pipeline'
|
||||||
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
||||||
@ -138,8 +139,8 @@ const WebsiteCrawl = ({
|
|||||||
setCrawlErrorMessage('')
|
setCrawlErrorMessage('')
|
||||||
setStep(CrawlStep.finished)
|
setStep(CrawlStep.finished)
|
||||||
},
|
},
|
||||||
onError: (message: string) => {
|
onDataSourceNodeError: (error: DataSourceNodeErrorResponse) => {
|
||||||
setCrawlErrorMessage(message || t(`${I18N_PREFIX}.unknownError`))
|
setCrawlErrorMessage(error.error || t(`${I18N_PREFIX}.unknownError`))
|
||||||
setStep(CrawlStep.finished)
|
setStep(CrawlStep.finished)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user