The code does catch the exception but the result is that the local ha_conf/<router>/state file remains set to "master"
The code does catch the exception but the result is that the local ha_conf/ <router> /state file remains set to "master"