Improve HMR error handling #410