fix: return 409 on duplicate kontonummer, show server error in snackbar, block save when sub-account suffix is empty

This commit is contained in:
Matthias Hochmeister
2026-03-30 11:03:53 +02:00
parent 2e736f7995
commit b7015ace84
3 changed files with 9 additions and 5 deletions

View File

@@ -167,9 +167,10 @@ class BuchhaltungController {
try {
const data = await buchhaltungService.createKonto(req.body, req.user!.id);
res.status(201).json({ success: true, data });
} catch (error) {
} catch (error: any) {
logger.error('BuchhaltungController.createKonto', { error });
res.status(500).json({ success: false, message: 'Konto konnte nicht erstellt werden' });
const status = error.statusCode || 500;
res.status(status).json({ success: false, message: error.message || 'Konto konnte nicht erstellt werden' });
}
}