Hyrax is a Ruby on Rails Engine built by the Samvera community. Hyrax provides a foundation for creating many different digital repository applications.
[ ] Detect the matomo error response and 'fail' gracefully in the same way as the current error checkreturn [] if response.status != 200
Rationale (for feature request only)
Parsing the API response for an error result feels relatively fragile but there doesn't seem to intent to change the pattern - see https://matomo.org/faq/how-to/faq_20278/ and https://github.com/matomo-org/matomo/issues/18851. Additionally, with the existing behavior the dashboard will crash rendering it unusable on the few occasions our matomo service has been down.
Descriptive summary
Matomo doesn't report API errors through status codes. It returns errors in the form of:
{"result":"error","message":"error message"}
The current matomo integration checks for http status codes and will fail when trying to parse the matomo error response.
Steps to reproduce the behavior in User Interface (UI)
Preconditions:
HYRAX_ANALYTICS_PROVIDER
To see the error behavior:
Actual behavior
An ActionView::Template::Error is thrown
Acceptance Criteria/Expected Behavior
return [] if response.status != 200
Rationale (for feature request only)
Parsing the API response for an error result feels relatively fragile but there doesn't seem to intent to change the pattern - see https://matomo.org/faq/how-to/faq_20278/ and https://github.com/matomo-org/matomo/issues/18851. Additionally, with the existing behavior the dashboard will crash rendering it unusable on the few occasions our matomo service has been down.