#How to pass response from map projection to tap error handler

5 messages · Page 1 of 1 (latest)

gusty stratus
#

I get the error Expected 0-1 arguments, but got 2. when I do throw new Error('',{cause: response})

obs$.pipe(map(response => {
if (response.valid) {
// do stuff
} else {
throw new Error('',{cause: response})
}
}),tap((value) => {
     
    }, (err) => {
// trying to get response here
      console.log('hey',err)
    }))
gusty stratus
gaunt dirge
#

Check the compilerOptions/lib property in your tsconfig.json. You probably have a version that is less than ES2022, there. This constructor has een introduced in ES2022,so you'd need to have that version.

gusty stratus
gaunt dirge
#

That's the default value in projects created now with the CLI, so it should be supported by the browsers supported by Angular.