Enhance security and error handling in various components by refining error catch blocks to ignore specific errors, improving code clarity and consistency across the application.

This commit is contained in:
Torsten Schulz (local)
2025-12-20 15:05:49 +01:00
parent 3e956ac46b
commit d89cabdd34
42 changed files with 117 additions and 113 deletions

View File

@@ -54,7 +54,7 @@ export class PDFGeneratorService {
const pdfBytes = await pdfDoc.save()
return new PDFGenerationResult(true, Buffer.from(pdfBytes), filename)
} catch (error) {
} catch (_error) {
console.error('Template PDF generation failed:', error.message)
return new PDFGenerationResult(false, null, null, error.message)
}
@@ -69,11 +69,11 @@ export class PDFGeneratorService {
try {
await fs.access(this.templatePath)
return this.templatePath
} catch (error) {
} catch (_error) {
try {
await fs.access(this.fallbackTemplatePath)
return this.fallbackTemplatePath
} catch (fallbackError) {
} catch (_fallbackError) {
throw new Error('No PDF template found')
}
}
@@ -86,7 +86,6 @@ export class PDFGeneratorService {
*/
generateFilename(data) {
const timestamp = Date.now()
const name = `${data.nachname || 'Unbekannt'}_${data.vorname || 'Unbekannt'}`
return `beitrittserklärung_${timestamp}.pdf`
}