I'm calling an API in Angular and trying to get the response body, but it just displays error message is [object Object]
I've tried just doing console.log(error), error.text() ,JSON.parse(error._body).errors ,error.error ,error.message and error.json()but none worked.
This is my code, would really appreciate some help:
  doImport = (dataObj) => {
    for(let i = 0; i<this.uploadedFilesCount; i++) {
      const filename = this.uploadedFileNames[i];
      this.disableDeployCTA = true;
      const params:string = filename + "/" + this.testStartTime + "/" + this.userNtId + "/" + this.userTeamID + "/" + this.userTeam; 
      var res = '';
      this.httpService.importUML(params).subscribe((response: any) => {        
        this.toastmessage.success('Successfully created test #'+i); 
        this.toastmessage.clear();
      },                              
      (error) => {
        console.log("error message is "+error.message);
        if(error.status == 409) {
          if(res.indexOf("static data")!=-1) {
            this.toastmessage.error(filename + ": That static data exists already!");
          }
          else {
            this.toastmessage.error(filename + ": That test case exists already! Please change test case name.");
          }
        }
        else if(error.status == 400) {
          this.toastmessage.error(filename + ": Incorrectly formatted UML. Please fix and try again.");
        }
      });
    }
    this.resetAxiForm();
    this.disableImport = true; 
  } 
And the error response I want to get:


 
    