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:
@@ -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`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user