fix error handle
Main daploy / deploy (push) Successful in 37s

This commit is contained in:
2024-11-19 00:18:24 +02:00
parent 1a11efe25d
commit cd33c37969
2 changed files with 6 additions and 7 deletions
+4 -6
View File
@@ -44,12 +44,10 @@ export const createQrCodeDocument = async (
} }
export const getQrCodeDocument = (uri: string) => { export const getQrCodeDocument = (uri: string) => {
try { return qrCodeDbLocal.get<QRCodeDocument>(`qr_code:${uri}`).catch((error) => {
return qrCodeDbLocal.get<QRCodeDocument>(`qr_code:${uri}`) if (error.name === 'not_found') {
} catch (e) {
if ((e as { code: string }).code === 'not_found') {
return qrCodeDbRemote.get<QRCodeDocument>(`qr_code:${uri}`) return qrCodeDbRemote.get<QRCodeDocument>(`qr_code:${uri}`)
} }
throw e throw error
} })
} }
+2 -1
View File
@@ -108,7 +108,8 @@ onMounted(async () => {
try { try {
const qrCodeDoc = await getQrCodeDocument(qr_code_uri) const qrCodeDoc = await getQrCodeDocument(qr_code_uri)
presetMessages.value = qrCodeDoc!.predefinedMessage || [] presetMessages.value = qrCodeDoc!.predefinedMessage || []
} catch { } catch (err) {
console.error(err)
error.value = 'Ошибка загрузки данных QR‑кода' error.value = 'Ошибка загрузки данных QR‑кода'
} }
}) })