fix: when decrypting file, have better error messages #17
@ -62,7 +62,15 @@ export const DecryptZip = () => {
|
||||
encryptionKey
|
||||
).catch((err) => {
|
||||
console.log('err in decryption:>> ', err)
|
||||
|
||||
if (err.message.toLowerCase().includes('expected')) {
|
||||
m marked this conversation as resolved
|
||||
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
I would say that a more convenient and reliable approach to handle errors is to have dedicated errors of custom type