mardi 4 mai 2021

Should we throw an exception if the resource we are trying to update results in no rows affected?

I am trying to implement repository pattern. I have a doubt where lets say we are trying to perform an update on a record that does not exist. In this case should we throw an exception? if yes should we throw argumentException or invalidoperation?

in case of argumentException, the input isn't valid. but the input can be valid and still the record wont exist. so should we throw invalidoperation as we are trying to perform an opertation on a resource that does not exist?

Aucun commentaire:

Enregistrer un commentaire