samvera / questioning_authority

Question your authorities
Other
54 stars 30 forks source link

performance data for linked data term fetch fails if there are predicates is nil #247

Closed elrayle closed 5 years ago

elrayle commented 5 years ago

Description

If results['predicates'].blank?, then results['predicates'].size` raises an exception.

Expected

If results['predicates'].blank?, #append_performance_data in find_term.rb should set...

performance = { predicate_count: 0, ...}

Actual

If results['predicates'].blank?, #append_performance_data in find_term.rb raises...

exception Undefined method :size for NilClass
elrayle commented 5 years ago

This should never happen. If we get any results at all, there will always be at least one predicate.

The reason this happened was that data was returned for a fetch term request by ID, but then the normalization process was not able to identify the URI associated with the ID. So it failed to extract any of the data from the graph.

So the real error here is that if data cannot be extracted from the graph, it should fail more gracefully with a good error message.

Related Issues:

244 loc linked data fails to fetch term for subauthority classification