Fix incorrect throw in ResourceStore#saveResource