lib/ecoportal/api/common/content/collection_model.rb in ecoportal-api-v2-0.9.6 vs lib/ecoportal/api/common/content/collection_model.rb in ecoportal-api-v2-0.9.7
- old
+ new
@@ -173,10 +173,10 @@
# Otherwise it pushes it to the end
# @value [Hash, Ecoportal::API::Common::Content::DoubleModel] the eleement to be added
# @return [Object] the `items_class` element object
def upsert!(value, pos: NOT_USED, before: NOT_USED, after: NOT_USED)
unless value.is_a?(Hash) || value.is_a?(Content::DoubleModel)
- raise "'Content::DoubleModel' or 'Hash' doc required"
+ raise "'Content::DoubleModel' or 'Hash' doc required. Given #{value.class}"
end
item_doc = value.is_a?(Content::DoubleModel)? value.doc : value
item_doc = JSON.parse(item_doc.to_json)
if item = self[value]
item.replace_doc(item_doc)