# PostLoginAction throw error

**URL:** <https://community.auth0.com/t/postloginaction-throw-error/60759>\
**Category:** Get Help\
**Tags:** actions\
**Created:** [April 8, 2021, 9:58am UTC](https://community.auth0.com/t/postloginaction-throw-error/60759 "2021-04-08T09:58:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexab](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alexab/32/13403_2.png) [@alexab](https://community.auth0.com/u/alexab)\
**Post date:** [April 8, 2021, 9:58am UTC](https://community.auth0.com/t/postloginaction-throw-error/60759/1 "2021-04-08T09:58:47Z")

</div>

What happens in the postLoginAction when we:

1. Throw an error like this?

```auto
throw new Error("some failure");

```

1. Return a command of type “deny”?

```auto
return {
       command: {
            type: "deny",
            reason: "some crazy reason!",
        }
    }

```

Will subsequent actions continue to execute in both cases?  
Will the end-user always be redirected to the application page, or can the errors be propagated to the universal login-page?

Thanks for clarification.

---

<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:** [April 9, 2021, 12:08pm UTC](https://community.auth0.com/t/postloginaction-throw-error/60759/3 "2021-04-09T12:08:53Z")

</div>

Hi @alexab,

After some initial testing, it looks like other actions in the flow do not execute, but I am confirming this now. Thanks!

---

<div class="post-metadata">

**Author:** ![alexab](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alexab/32/13403_2.png) [@alexab](https://community.auth0.com/u/alexab)\
**Post date:** [April 9, 2021, 12:18pm UTC](https://community.auth0.com/t/postloginaction-throw-error/60759/4 "2021-04-09T12:18:56Z")

</div>

I think I found the answer for the second question, i.e. the user will be redirected to the application page (it is after all called a powerLoginAction)

---

<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:** [April 9, 2021, 2:15pm UTC](https://community.auth0.com/t/postloginaction-throw-error/60759/5 "2021-04-09T14:15:12Z")

</div>

I’ve confirmed that in both scenarios, a thrown exception will ALWAYS reject the login, meaning other actions in the flow should not run when an error is thrown or the `deny` command is used. And yes, the user will be redirected to the app with the error in both cases.

Note: After the general release of actions, it’s possible that throwing exceptions will no longer be used as the preferred control-flow mechanism like it was in rules. Denying access will likely look more like the second method or a new API method. More info to come with the general release!

---

<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:** [April 24, 2021, 2:15pm UTC](https://community.auth0.com/t/postloginaction-throw-error/60759/6 "2021-04-24T14:15:59Z")

</div>

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