making error handler generator a private method