hyrax icon indicating copy to clipboard operation
hyrax copied to clipboard

Hyrax::Analytics::Google#profile should raise (and handle) a more specific error

Open jeremyf opened this issue 3 years ago • 0 comments

Referencing the following code:

https://github.com/samvera/hyrax/blob/27d62a2338bd9e49f942e7e73829f91f2e8115eb/app/services/hyrax/analytics/google.rb#L96-L106

The current state of the application is raising a RuntimeError when the user doesn't have an matching profile_id. This is treated as a server error, leaving no mechanism for folks to correct. Instead, it should probably be raising an exception that is handled as an Authorization error. For example, we can use a controller rescue_from block to capture a named exception.

Discovered in https://gitlab.com/notch8/utk-hyku/-/issues/112

jeremyf avatar Aug 29 '22 15:08 jeremyf