class to manage error