add method for working with errors