add error handler for checking reg access
update deprecated mocha require