cofoundry-cms / cofoundry

Cofoundry is an extensible and flexible .NET Core CMS & application framework focusing on code first development

Home Page:https://www.cofoundry.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DomainRepository: Patch: Better handling of nulls

HeyJoel opened this issue · comments

See #536, better handling when an IPatchableCommand returns null (entity not found). Copied from #536:

it's never good to get a NullReferenceException, and Cofoundry should be throwing a better error in this scenario where a patch command might not find the entity to update, perhaps a NotFoundException, or a validation exception? I'm not sure which is most appropriate without having a closer look, but I expect NotFoundException would be best becuse generally when executing a patch you are expecting the entity to exist.