object_add: consolidate error handling