fix: return 409 on duplicate kontonummer, show server error in snackbar, block save when sub-account suffix is empty
This commit is contained in:
@@ -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' });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user