The catch is there to catch something wrong that you did in your onResolved or onRejected clauses, not to catch the fact that the promise was rejected and never resolved. I hope this helps!
Alternatively, you can turn the promises into observables and deal with them as such.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
hi! is there a way to avoid "uncaught (in promise) not authenticated" error being showed in console on:
await Auth.currentAuthenticatedUser()
.then(user => {
...some stuff
})
.catch(e => {
history.push("/auth");
});
The app will redirect to /auth each time is not authenticated but we dont want to see not authenticated error in console in production
Did you ever figure this out? I get that same error.
In your .then(), provide an onRejected clause:
Auth.currentAuthenticatedUser().then((user) => { ... }, (error) => { ... }).catch((error) => { ... })
The catch is there to catch something wrong that you did in your onResolved or onRejected clauses, not to catch the fact that the promise was rejected and never resolved. I hope this helps!
Alternatively, you can turn the promises into observables and deal with them as such.