Properly set error on validation error