Class: LD4L::WorksRDF::SetErrorInMetadata

Inherits:
Object
  • Object
show all
Defined in:
lib/ld4l/works_rdf/services/metadata_services/set_error_in_metadata.rb

Class Method Summary collapse

Class Method Details

.call(uri, error_message) ⇒ Object

Set an error message and basic metadata for an error state

Parameters:

  • uri (String, RDF::URI)

    for the work

  • error (String)

    message

Raises:

  • (ArgumentError)


12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ld4l/works_rdf/services/metadata_services/set_error_in_metadata.rb', line 12

def self.call( uri, error_message )
  raise ArgumentError, 'uri argument must be a uri string or an instance of RDF::URI'  unless
      uri.kind_of?(String) && uri.size > 0 || uri.kind_of?(RDF::URI)

  # TODO it may make more sense for handling of error messages to be in the WorkMessage model itself instead of here
   = LD4L::WorksRDF::WorkMetadata.new(nil)
  .uri              = uri
  .title            = uri
  .error            = true
  .error_message    = error_message
  
end