#paulwest-confirm-error

1 messages · Page 1 of 1 (latest)

shy agate
#

Hi there! Is that your full code? Currently you aren't doing anything with the error?

true rapids
#

why not use async/await and try/catch block??

urban dirge
#

I cut down the code to make it more readable.
I appreciate there are other ways this can be done.
I just want to know when the error object can't be read in the catch block.

#

I will add some more code.

#

expaned catch block
.catch(error => {
alert (error)
}

shy agate
#

Yeah there are various reasons this could be happening, the full snippet would be best.

urban dirge
#

returns Cannot read properties of undefined (reading 'id')

shy agate
#

Hmm okay one sec

urban dirge
#

I can give you the full code if you wish

shy agate
#

Yeah that would make it easier

urban dirge
#

Too big for me to send. I will try and rationalise it down to

shy agate
#

Ah

#

I see it

#

You have an extra .

#
.catch(error => {```
#

Try removing that?

#

One of those

urban dirge
#

that was a typo, it does not exist

#

The code is working, it is hitting the catch block and executing the code inside, I just can't seem to access the error object.

shy agate
#

Ah okay so what is happening is that the promise is fulfilling and your error is in your results block

urban dirge
#

Figured, that might be the case, i was trying to avoid having to put a hard to read if else statement inside the .then.