Skip to content

Commit

Permalink
Adding checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
emarinier committed Feb 3, 2025
1 parent ea4271c commit f5a8529
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,24 @@ class SamplesheetParser extends PluginExtensionPoint {
final IridaNextJSONOutput iridaNextJSONOutput = IridaNextJSONOutput.getInstance()

final next = { it ->
// Check that it's a map and the id_key exists, ignore and warn otherwise / trace
def meta = it[0] // TODO: Check with workflow that's not just metadata
def meta = it[0]
def id = meta[this.id_key]

iridaNextJSONOutput.addId(scope, id)
if(meta instanceof Map<String,Object>)
{
if(meta.containsKey(this.id_key))
{
iridaNextJSONOutput.addId(scope, id)
}
else {
throw new Exception("The expected key (${this.id_key}) was not found in the meta map.")
}

}
else {
throw new Exception("Expected a Map object in channel, but found ${meta}.")
}

target.bind(it)
}

Expand Down

0 comments on commit f5a8529

Please sign in to comment.