change to use error constructor