Skip to content

handle when EML does not validate in init_datapkg #5

Description

@twhiteaker

The code below has an if statement to validate the EML, but it doesn't do anything if it doesn't validate. Add an else to report when EML does not validate, and then stop.

tryCatch({
  eml_3 <-
    create_EML(metadata, entities_3, 3, here::here())
  if (eml_validate(eml_3))
    # if above validation returns TRUE, then serialize to XML file
    write_eml(eml_3,
              file = file.path(as.character(2023), paste0("EML_", 3, "_", Sys.Date(), ".xml")))
},
error = function(e) {
  stop(e)
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions