feat(meta): add error handling for meta.json blossom operations
All checks were successful
Open PR on Staging / audit_and_check (pull_request) Successful in 45s

This commit is contained in:
enes 2024-12-13 12:39:00 +01:00
parent 3d1bdece4d
commit 7007492a0d
3 changed files with 19 additions and 5 deletions

View File

@ -868,11 +868,11 @@ export const CreatePage = () => {
setLoadingSpinnerDesc('Updating user app data')
const metaUrl = await uploadMetaToFileStorage(meta, encryptionKey)
const event = await updateUsersAppData(meta)
if (!event) return
const metaUrl = await uploadMetaToFileStorage(meta, encryptionKey)
setLoadingSpinnerDesc('Sending notifications to counterparties')
const promises = sendNotifications({
metaUrl,

View File

@ -753,7 +753,17 @@ export const SignPage = () => {
return
}
const metaUrl = await uploadMetaToFileStorage(meta, encryptionKey)
let metaUrl: string | undefined
try {
metaUrl = await uploadMetaToFileStorage(meta, encryptionKey)
} catch (error) {
if (error instanceof Error) {
toast.error(error.message)
}
console.error(error)
setIsLoading(false)
return
}
const userSet = new Set<`npub1${string}`>()
if (submittedBy && submittedBy !== usersPubkey) {

View File

@ -949,8 +949,12 @@ const processReceivedEvent = async (event: Event, difficulty: number = 5) => {
encryptionKey = decrypted
}
meta = await fetchMetaFromFileStorage(notification.metaUrl, encryptionKey)
try {
meta = await fetchMetaFromFileStorage(notification.metaUrl, encryptionKey)
} catch (error) {
console.error(`An error occured fetching meta file from storage`, error)
return
}
} else {
meta = parsedContent
}