add error handler class

add ErrorHandler class to handle log errors