psu-libraries / scholarsphere-3

A web application for ingest, curation, search, and display of digital assets. Powered by Hydra technologies (Rails, Hydra-head, Blacklight, Solr, Fedora Commons, etc.)
Apache License 2.0
78 stars 24 forks source link

Strange errors in the dashboard with proxy deposits #461

Closed carolyncole closed 6 years ago

carolyncole commented 7 years ago

New Note 4

2016-11-17 11:53:53 -0500 (30460) ActiveFedora::ActiveFedoraError (Model mismatch. Expected CurationConcerns::WorkRelation::DummyModel. Got: FileSet):
active-fedora (10.3.0.rc2) lib/active_fedora/relation/finder_methods.rb:204:in class_to_load' active-fedora (10.3.0.rc2) lib/active_fedora/relation/finder_methods.rb:195:inload_from_fedora'
active-fedora (10.3.0.rc2) lib/active_fedora/relation/finder_methods.rb:181:in find_one' active-fedora (10.3.0.rc2) lib/active_fedora/relation/finder_methods.rb:228:infind_with_ids'
active-fedora (10.3.0.rc2) lib/active_fedora/relation/finder_methods.rb:52:in find' active-fedora (10.3.0.rc2) lib/active_fedora/relation/finder_methods.rb:85:inexists?'
/opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/bundler/gems/sufia-35c01618b4d3/app/models/proxy_deposit_request.rb:83:in `deleted_work?'

carolyncole commented 7 years ago

It seems that if you have old proxies where the item no longer exists you get a very strange error about model miss match. Once I deleted my proxy deposit request all was well. That said we should look at how those request are being migrated and make sure they work.

carolyncole commented 7 years ago

Handle any StandardException (Runtime or Other) instead of erroring

awead commented 7 years ago

Steps to recreate:

  1. bundle exec rake dev:clean db:reset
  2. bundle exec rails s
  3. log in and create a work
  4. Visit the file set page for the work and copy the file set id from the url
  5. bundle exec rails c
  6. user = User.create
  7. ProxyDepositRequest.create(work_id: [fileset id], sending_user_id: [your user id], receiving_user_id: user.id)
  8. Visit http://localhost:3000/dashboard with your user id logged in
carolyncole commented 7 years ago

@awead was there a change to handle the error? Or did we decide not to handle the error? What makes this ticket closed?

awead commented 7 years ago

@cam156 I've rescued the error here:

https://github.com/psu-stewardship/scholarsphere/commit/6699ed03c926a3ca33d5b856e4b8662c323bcebf#diff-bc64481b69da55982a8f91c2b2eca2fbR86

If you recall, there's a PR that's ready to merge that addresses this, but we decided to hold off on merging because we're overriding an entire class to make a one-line change, and the error will not occur in the normal course of operations, only when migrating.

carolyncole commented 7 years ago

@awead I moved the ticket to the next milestone. I had forgotten to do that earlier.

awead commented 7 years ago

@cam156 thanks!