error dialog introduced

This commit is contained in:
2021-11-02 13:06:34 +01:00
parent 272500df8c
commit 0e1e03f1a9
9 changed files with 109 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import { MatExpansionPanel } from '@angular/material/expansion';
import { MatTableDataSource } from '@angular/material/table';
import { AccountEntryCategoryService, AccountEntryService, AccountService } from '../data-object-service';
import { Account, AccountEntry, AccountEntryCategory, NULL_AccountEntry } from '../data-objects';
import { ErrorDialogService } from '../error-dialog.service';
import { ExtApiService } from '../ext-data-object-service';
import { Saldo } from '../ext-data-objects';
import { MessageService } from '../message.service';
@ -46,7 +47,8 @@ export class AccountComponent implements OnInit {
private accountEntryService: AccountEntryService,
private extApiService: ExtApiService,
private accountEntryCategoryService: AccountEntryCategoryService,
private messageService: MessageService
private messageService: MessageService,
private errorDialogService: ErrorDialogService
) { }
@ -111,11 +113,12 @@ export class AccountComponent implements OnInit {
newAccountEntry = await this.accountEntryService.postAccountEntry(newAccountEntry)
this.messageService.add(`New accountEntry created: ${newAccountEntry.id}`)
formData.reset()
this.getAccountEntries()
} catch (err) {
this.messageService.add(`Error in addAccountEntry: ${JSON.stringify(err, undefined, 4)}`)
this.errorDialogService.openDialog('AccountComponent', 'addAccountEntry', JSON.stringify(err, undefined, 4))
} finally {
formData.reset()
this.addAccountEntryButton.disabled = false
}
}