WIP multi error catching

pull/8/head
FlayInAHook 4 years ago
parent f921f7897a
commit 4ed344b82e

@ -1,5 +1,6 @@
<h1 mat-dialog-title>Dialog with elements</h1>
<div mat-dialog-content>This dialog showcases the title, close, content and actions elements.</div>
<h1 mat-dialog-title>Erweiterte Fehlerinfos</h1>
<div mat-dialog-content *ngFor="let error of errorMessages">{{error["message"]}}</div>
<div mat-dialog-actions>
<button mat-button mat-dialog-close>Close</button>
</div>

@ -23,7 +23,8 @@ export class ErrorSnackbarComponent {
public actionAndDismiss(){
console.log("test");
this.dialog.open(SnackbarDialog);
let dialogRef = this.dialog.open(SnackbarDialog);
dialogRef.componentInstance.errorMessages = this.data.errorMessages;
this.snackBarRef.dismiss()
}
}
@ -32,4 +33,6 @@ export class ErrorSnackbarComponent {
selector: 'app-snackbar-dialog',
templateUrl: 'snackbar-dialog.html',
})
export class SnackbarDialog {}
export class SnackbarDialog {
errorMessages : Object[];
}

@ -29,7 +29,7 @@ export class TokenInterceptor implements HttpInterceptor {
errorMessage = `Error: ${error.error.message}`;
} else {
//server error
console.log("Error: " + JSON.stringify(error));
//console.log("Error: " + JSON.stringify(error));
if (error.status === 400){
switch (error.error.message) {
case "Invalid refresh token!":

@ -10,9 +10,9 @@ export class SnackBarService {
constructor(private snackBar : MatSnackBar) { }
openSnackBar(message: string, action: string = "", error: boolean = false, errorMessageArray: Object[] = undefined) {
openSnackBar(message: string, action: string = "", error: boolean = false, errorMessages: Object[] = undefined) {
if (error){
if (errorMessageArray === undefined){
if (errorMessages === undefined){
this.snackBar.open(message, action, {
duration: 5000,
panelClass: ['mat-toolbar', 'mat-warn', 'simple-snack-bar']
@ -22,6 +22,7 @@ export class SnackBarService {
data: {
"message" : message,
"action" : action,
"errorMessages" : errorMessages
},
panelClass: ['mat-toolbar', 'mat-warn', 'simple-snack-bar'],
duration: 5000

Loading…
Cancel
Save