Freeze during put request

Is there any high level way to introduce a function in your code that monitors for timeout's or errors and if a function doesn't complete within x number of seconds then it resets the module?

Interested to help in any further testing you might be doing too.