Hi njem and welcome to technet.
There is no way to customize the default IWP error messages that I know of, that's more of a CWP thing that you code yourself.
I would be looking at how to change your solution to avoid those errors from occurring in the first place. If you need more robust applications and error detection, then CWP might be worth the investment for your solution.
The application is good sized and converting from IWP to PHP would be a massive project, and other than this issue IWP works great for this. As far as avoiding these errors, I don't know how any IWP or CWP app can avoid a time out error. You don't want people who walk away logged on for long. Not when it's a public app and you might accumulate tons of people logged on, many sessions idle. And there's the 59min limit in any case. So there's going to be a time out.
When that happens I either need to show a msg just before it, or when they try to use it again, that says, "Your session time out. Log in again." and maybe "Click here to get back to login". The default msg is technical, intimidating, and confusing in this case. It says, "communication with the server has been lost". Sounds serious to the lay user. "reselect the database to begin a new session". The user will think, "what database?" They didn't even know they were in a database. This is just a public web page they were given a link to which allows entry of info about a charity project they're participating in. "If you cannot, contact your database administrator". They'd think, "what administrator?" Besides, they don't need to contact anyone, just log in again.
So I can't change the default msg, timmer triggers don't work in IWP and I'm not sure that's a good solution anyway, and FM doesn't create an on-timeout event that could be used as a trigger for a custom msg, so it sounds like I'm stuck but I'm hoping someone has a work around. I can't be the first person to need this. Even for people who use IWP for DBs used by in-house employees they probably have to explain this msg, "If you see this msg you need to go back and log in again" or some such. So I'm still hoping someone has a better solution?