Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rescue versioning exceptions and provide more context #397

Merged
merged 1 commit into from Sep 11, 2019

Conversation

mjgiarlo
Copy link
Member

Why was this change made?

To provide more information to downstream consumers why operations fail and for which objects.

Was the API documentation (openapi.json) updated?

No, and it didn't need to be.

@mjgiarlo mjgiarlo added this to Needs Review in Infrateam Aug-Sep 2019 via automation Sep 11, 2019
Copy link
Member

@ndushay ndushay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yum.

@@ -12,7 +12,7 @@ def create
parent_id, child_ids = virtual_object.values_at(:parent_id, :child_ids)
# Update the constituent relationship between the parent and child druids
errors << ConstituentService.new(parent_druid: parent_id).add(child_druids: child_ids)
rescue ActiveFedora::ObjectNotFoundError, Rubydora::FedoraInvalidRequest => e
rescue ActiveFedora::ObjectNotFoundError, Rubydora::FedoraInvalidRequest, Dor::Exception => e
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yaaaaaaas

raise Dor::Exception, 'accessionWF already created for versioned object' if accessioning?
raise Dor::Exception, "latest version in versionMetadata for #{work.pid} requires tag and description before it can be closed" unless work.versionMetadata.current_version_closeable?
raise Dor::Exception, "Trying to close version on #{work.pid} which is not opened for versioning" unless open_for_versioning?
raise Dor::Exception, "accessionWF already created for versioned object #{work.pid}" if accessioning?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yaaaaaaas

@ndushay ndushay merged commit 96003dc into master Sep 11, 2019
Infrateam Aug-Sep 2019 automation moved this from Needs Review to Done Sep 11, 2019
@ndushay ndushay deleted the rescue_version_errors branch September 11, 2019 22:45
@sul-dlss sul-dlss deleted a comment from coveralls Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants