# Handle Logout error in React SDK

**URL:** <https://community.auth0.com/t/handle-logout-error-in-react-sdk/63235>\
**Category:** Get Help\
**Created:** [May 23, 2021, 9:36pm UTC](https://community.auth0.com/t/handle-logout-error-in-react-sdk/63235 "2021-05-23T21:36:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sachindraragul](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sachindraragul/32/12846_2.png) [@sachindraragul](https://community.auth0.com/u/sachindraragul)\
**Post date:** [May 23, 2021, 9:36pm UTC](https://community.auth0.com/t/handle-logout-error-in-react-sdk/63235/1 "2021-05-23T21:36:21Z")

</div>

Hi,

I’m trying to handle an error scenario during logout . I’m not able to do so using try catch block. Any documentation on the possible errors and response that might occur during logout and how to do it?

```
 try {
  logout({ returnTo: window.location.origin });
} catch (e) {
// Show an alert
}

```

SDK : auth0-react  
SDK Version: 1.0.0  
Platform Version: Node 14.16.1

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [May 26, 2021, 2:41pm UTC](https://community.auth0.com/t/handle-logout-error-in-react-sdk/63235/3 "2021-05-26T14:41:51Z")

</div>

Hi @sachindraragul,

There aren’t any documented errors for the `logout` function. This function doesn’t call an API or anything that could be caught in a `try/catch`, but simply redirects the user to your tenant’s `/logout` URL. An error might occur if your application or tenant does not have an allowed logout URL configured, but this is not something that could be caught in the application code. The logout URL is configured in your Auth0 dashboard.

Hope that helps!

Stephanie

---

<div class="post-metadata">

**Author:** ![sachindraragul](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sachindraragul/32/12846_2.png) [@sachindraragul](https://community.auth0.com/u/sachindraragul)\
**Post date:** [May 27, 2021, 6:46am UTC](https://community.auth0.com/t/handle-logout-error-in-react-sdk/63235/4 "2021-05-27T06:46:56Z")

</div>

Thank you for the confirmation.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [June 11, 2021, 6:47am UTC](https://community.auth0.com/t/handle-logout-error-in-react-sdk/63235/5 "2021-06-11T06:47:12Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
