Angular Specribe Catch Stat

 signIn(user: Login) {
    //console.log("the path = "+this.loginPath);
    return this.http
      .post<any>(this.loginPath, user)
      .subscribe((res: any) => {
        localStorage.setItem('accessToken', res.accessToken);
        console.log(res);
        this._authenticated= true;
        this.router.navigate(['board']);

      },(error: any) => {
        console.log(error);
        if(error.status ==401){
          alert("Login or Password not exist");
        }
      },
        () => {
        console.log("Finally clause");
      }
      );
  }
Mohamed Sami khiari