move error handler behavior to class on its own.