# Switching users

**URL:** <https://forum.inductiveautomation.com/t/switching-users/2753>\
**Category:** Ignition\
**Created:** [March 11, 2011, 5:11pm UTC](https://forum.inductiveautomation.com/t/switching-users/2753 "2011-03-11T17:11:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [March 11, 2011, 5:11pm UTC](https://forum.inductiveautomation.com/t/switching-users/2753/1 "2011-03-11T17:11:05Z")

</div>

We are using the system.security.switchUser function to switch users. In case the function fails, we put this in a try…except block, but the following error is still raised:`GatewayException: Gateway Error 302: Login failed.`Why are we not able to catch this error? We are running on Ignition v7.2.3.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [March 12, 2011, 12:22am UTC](https://forum.inductiveautomation.com/t/switching-users/2753/2 "2011-03-12T00:22:41Z")

</div>

This is an oversight on our part. I’ve altered this function so that going forward you can specify a [tt]hideError=1[/tt] parameter on it so suppress the error message, and you can check for a return value of zero to see if it failed.
