fix: when decrypting file, have better error messages
This commit is contained in:
parent
15a3d83610
commit
5d6a3580a6
@ -62,7 +62,15 @@ export const DecryptZip = () => {
|
||||
encryptionKey
|
||||
).catch((err) => {
|
||||
console.log('err in decryption:>> ', err)
|
||||
toast.error(err.message || 'An error occurred while decrypting file.')
|
||||
|
||||
if (err.message.toLowerCase().includes('expected')) {
|
||||
toast.error(`The Key seems to be invalid length or format`)
|
||||
} else if (err.message.includes('The JWK "alg" member was inconsistent')) {
|
||||
toast.error(`The Key seems to be invalid.`)
|
||||
} else {
|
||||
toast.error(err.message || 'An error occurred while decrypting file.')
|
||||
}
|
||||
|
||||
setIsLoading(false)
|
||||
return null
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user