Skip to content

Commit

Permalink
Merge pull request #6868 from samvera/add-lonely-operator
Browse files Browse the repository at this point in the history
Add lonely operator for error message
  • Loading branch information
laritakr authored Aug 5, 2024
2 parents 59a42ad + 0820463 commit 55af3a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/services/hyrax/custom_queries/find_file_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def find_file_metadata_by(id:)
result = query_service.find_by(id: id)
unless result.is_a? Hyrax::FileMetadata
raise ::Valkyrie::Persistence::ObjectNotFoundError,
"Result type #{result.internal_resource} for id #{id} is not a `Hyrax::FileMetadata`"
"Result type #{result&.internal_resource} for id #{id} is not a `Hyrax::FileMetadata`"
end
result
end
Expand All @@ -44,7 +44,7 @@ def find_file_metadata_by_alternate_identifier(alternate_identifier:)
result = query_service.find_by_alternate_identifier(alternate_identifier: alternate_identifier)
unless result.is_a? Hyrax::FileMetadata
raise ::Valkyrie::Persistence::ObjectNotFoundError,
"Result type #{result.internal_resource} for alternate_identifier #{alternate_identifier} is not a `Hyrax::FileMetadata`"
"Result type #{result&.internal_resource} for alternate_identifier #{alternate_identifier} is not a `Hyrax::FileMetadata`"
end
result
end
Expand Down

0 comments on commit 55af3a5

Please sign in to comment.