change error to exception