Is there is any way to assert when the network goes down inbetween automation

I am testing my app but sometimes due to intermittent issues in network I am getting no network error. Is there is any way to handle it. Right now as a workaround i wrote a method to identify the Network error message and made it to wait for sometime.Can we call this method before each action say click,sendkeys., And how to check the network inbetween the assertions i make.

Kindly let me know if there is any workaround