How to add one more exception rule in Angular?

0

Before showing my problem I would like to inform you that my form is able to insert records in the database, I created an exception in my java API, the error message in the figure below is expected, but my Angular project is only able to issue exceptions generic, and I need to create an error message for this exception below and I do not know how to do it.

Look at the image:

Thisisthecoderesponsibleforcatchingthegenericexception,anditisinthiscodethatyoumustmodifytobeabletogenerateamessageforthespecificexceptionwiththenameofNameStreamException

import{Injectable}from'@angular/core';import{ToastyService}from'ng2-toasty';@Injectable()exportclassErroHandlerService{constructor(privatetoasty:ToastyService){}handle(errorResponse:any){letmsg:string;if(typeoferrorResponse==='string'){msg=errorResponse;}else{msg='Erroaoprocessarserviçoremoto.Tentenovamente.';console.error('Ocorreuumerro',errorResponse);}this.toasty.error(msg);}}

IknowthatIfoundatemplatesimilartomineontheinternet,butIdonotknowhowtomakethischangetothesystemtotaketheexceptionofnameNameStyleNameException,andIneedhelp

Template

MY REPOSITORY

    
asked by anonymous 17.01.2018 / 18:23

0 answers