Skip to content

Commit f31a282

Browse files
committed
feat: update error handling in use download
1 parent 33d903d commit f31a282

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.1.9-beta-1",
3+
"version": "0.1.9-beta-2",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Hooks/UseDownload/UseDownload.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { HandleDownloadProps } from './types'
1010

1111
const useDownload = () => {
1212
const [isDownloading, setIsDownloading] = useState<boolean>(false)
13-
const [downloadError, setDownloadError] = useState<Error | ServerErrors>(null)
1413

1514
/**
1615
* @param downloadUrl - API url for downloading file
@@ -71,14 +70,14 @@ const useDownload = () => {
7170
throw new ServerErrors(jsonResponseError)
7271
}
7372
} catch (error) {
74-
setDownloadError(error)
7573
showError(error)
76-
} finally {
7774
setIsDownloading(false)
75+
return error
7876
}
77+
return null
7978
}
8079

81-
return { handleDownload, isDownloading, downloadError }
80+
return { handleDownload, isDownloading }
8281
}
8382

8483
export default useDownload

0 commit comments

Comments
 (0)