# Error Handler

**URL:** <https://forum.inductiveautomation.com/t/error-handler/9429>\
**Category:** Ignition\
**Created:** [December 11, 2014, 12:42am UTC](https://forum.inductiveautomation.com/t/error-handler/9429 "2014-12-11T00:42:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavidWisely](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/davidwisely/32/10482_2.png) [@DavidWisely](https://forum.inductiveautomation.com/u/DavidWisely)\
**Post date:** [December 11, 2014, 12:42am UTC](https://forum.inductiveautomation.com/t/error-handler/9429/1 "2014-12-11T00:42:09Z")

</div>

I have setup my project so that it automatically logs in as read-only mode using  
system.util.setConnectionMode(2)

In this state, when a user clicks on a button that writes a tag, Ignition displays it’s error message box.  
I would like to, instead of the error message, display a custom form telling the use that they need to login before changes can be made.

Is there a way to intercept error messages, test for a “Gateway Comm Mode is not Read/Write” error, and display my form instead?

Thanks,  
David

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [December 11, 2014, 1:41am UTC](https://forum.inductiveautomation.com/t/error-handler/9429/2 "2014-12-11T01:41:50Z")

</div>

You can write conditional code that checks for the read/write state of the client before using a function such as system.tag.write

You can check the read/write state of the client with system.util.getConnectionMode()

Example:

```auto
if system.util.getConnectionMode() != 2:
	system.tag.write(tagPath,value)
else:
	#display message code ...
```

---

<div class="post-metadata">

**Author:** ![DavidWisely](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/davidwisely/32/10482_2.png) [@DavidWisely](https://forum.inductiveautomation.com/u/DavidWisely)\
**Post date:** [December 11, 2014, 1:50am UTC](https://forum.inductiveautomation.com/t/error-handler/9429/3 "2014-12-11T01:50:40Z")

</div>

Thanks nmudge,

As there are a lot of places where tags are written this is not a feasible option.  
I was hoping there was some sort of software hook that I could use instead.

Any other ideas?
