Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public handleError(error: any | string): void {
if (!error) {
return;
}
let msg = errorHandler(error);
if (!(error.statusCode || error.status)) {
this.msgService.announceMessage(500, msg, AlertType.DANGER);
} else {
let code = error.statusCode || error.status;
if (code === httpStatusCode.Unauthorized) {
this.msgService.announceAppLevelMessage(code, msg, AlertType.DANGER);
// Session is invalid now, clare session cache
this.session.clear();
} else {
this.msgService.announceMessage(code, msg, AlertType.DANGER);
}
}
}
err => {
let errorMessageKey: string = errorHandFn(err);
this.translateService
.get(errorMessageKey)
.subscribe(errorMessage => this.inlineAlert.showInlineError(errorMessage));
this.added.emit(false);
}
);
catchError( error => {
const message = errorHandFn(error);
this.translateService.get(message).subscribe(res =>
operateChanges(operateMsg, OperationState.failure, res)
);
return observableThrowError(message);
}
)));
catchError( error => {
const message = errorHandFn(error);
this.translateService.get(message).subscribe(res =>
operateChanges(operateMsg, OperationState.failure, res)
);
return observableThrowError(message);
}
)));
.pipe(catchError(error => {
const message = errorHandFn(error);
this.translateService.get(message).subscribe(res =>
operateChanges(operMessage, OperationState.failure, res)
);
return observableThrowError(message);
}));
});
error => {
const message = errorHandFn(error);
this.translateService.get(message).subscribe(res =>
operateChanges(operMessage, OperationState.failure, res)
);
return observableThrowError(message);
}),
catchError(error => observableOf(error.status)), );
}), catchError(error => {
const message = errorHandFn(error);
this.translate.get(message).subscribe(res =>
operateChanges(operMessage, OperationState.failure, res)
);
return observableThrowError(message);
}));
};