error handler moved out of common