changed error to an exception class