Verbessere Fehlerbehandlung in der Verschlüsselung und PDF-Generierung durch Hinzufügen von Ursacheninformationen
This commit is contained in:
@@ -82,7 +82,7 @@ function decryptLegacyCBC(encryptedData, password) {
|
||||
return decrypted.toString('utf8')
|
||||
} catch (error) {
|
||||
// Re-throw mit mehr Kontext
|
||||
throw new Error(`Legacy CBC Entschlüsselung fehlgeschlagen: ${error.message}`)
|
||||
throw new Error(`Legacy CBC Entschlüsselung fehlgeschlagen: ${error.message}`, { cause: error })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ function decryptV2GCM(encryptedData, password) {
|
||||
return decrypted.toString('utf8')
|
||||
} catch (error) {
|
||||
// Re-throw mit mehr Kontext
|
||||
throw new Error(`GCM v2 Entschlüsselung fehlgeschlagen: ${error.message}`)
|
||||
throw new Error(`GCM v2 Entschlüsselung fehlgeschlagen: ${error.message}`, { cause: error })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ export function encrypt(text, password) {
|
||||
return encryptV2GCM(text, password)
|
||||
} catch (error) {
|
||||
console.error('Verschlüsselungsfehler:', error)
|
||||
throw new Error('Fehler beim Verschlüsseln der Daten')
|
||||
throw new Error('Fehler beim Verschlüsseln der Daten', { cause: error })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ export function decrypt(encryptedData, password) {
|
||||
if (error.message.includes('Entschlüsselung fehlgeschlagen')) {
|
||||
throw error
|
||||
}
|
||||
throw new Error(`Fehler beim Entschlüsseln der Daten: ${error.message}`)
|
||||
throw new Error(`Fehler beim Entschlüsseln der Daten: ${error.message}`, { cause: error })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,8 +73,8 @@ export class PDFGeneratorService {
|
||||
try {
|
||||
await fs.access(this.fallbackTemplatePath)
|
||||
return this.fallbackTemplatePath
|
||||
} catch (_fallbackError) {
|
||||
throw new Error('No PDF template found')
|
||||
} catch (fallbackError) {
|
||||
throw new Error('No PDF template found', { cause: fallbackError })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,7 +448,7 @@ export async function listSpielplanSeasons() {
|
||||
const bySlug = new Map()
|
||||
|
||||
for (const directory of directories) {
|
||||
let entries = []
|
||||
let entries
|
||||
try {
|
||||
entries = await fs.readdir(directory)
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user