Skip to content

Commit

Permalink
catch toJson errors
Browse files Browse the repository at this point in the history
  • Loading branch information
drernie committed Nov 5, 2024
1 parent 81f4083 commit 01daa2a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
23 changes: 16 additions & 7 deletions plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,12 @@ ${nextflow}

String writeNextflowMetadata(Map map, String suffix) {
String filename = "nf-quilt/${suffix}.json"
// log.debug("writeNextflowMetadata[$suffix]: ${filename}")
writeString(QuiltPackage.toJson(map), pkg, filename)
log.debug("writeNextflowMetadata[$suffix]: ${filename}")
try {
writeString(QuiltPackage.toJson(map), pkg, filename)
} catch (Exception e) {
log.error("writeNextflowMetadata.toJson failed: ${e.getMessage()}", map)
}
return filename
}

Expand All @@ -227,7 +231,7 @@ ${nextflow}
writeNextflowMetadata(params, 'params')
params.remove('genomes')
params.remove('test_data')
// printMap(params, 'params')
printMap(params, 'params')
}
Map wf = session.getWorkflowMetadata().toMap()
String start = wf['start']
Expand All @@ -241,7 +245,7 @@ ${nextflow}
wf.remove('complete')
wf.remove('workflowStats')
wf.remove('commandLine')
// printMap(wf, 'workflow')
printMap(wf, 'workflow')
log.info("\npublishing: ${wf['runName']}")
}

Expand All @@ -264,7 +268,7 @@ ${nextflow}
log.error("setupReadme failed: ${e.getMessage()}\n{$e}", pkg.meta)
}
if (text != null && text.length() > 0) {
//log.debug("setupReadme: ${text.length()} bytes")
log.debug("setupReadme: ${text.length()} bytes")
writeString(text, pkg, README_FILE)
}
return text
Expand Down Expand Up @@ -342,8 +346,13 @@ ${nextflow}
}
}

String qs_json = JsonOutput.toJson(quilt_summarize)
writeString(qs_json, pkg, SUMMARY_FILE)
try {
String qs_json = JsonOutput.toJson(quilt_summarize)
writeString(qs_json, pkg, SUMMARY_FILE)
}
catch (Exception e) {
log.error("setupSummarize.toJson failed: ${e.getMessage()}\n{$e}", SUMMARY_FILE)
}
return quilt_summarize
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class QuiltPackage {
List<String> entries = dict.collect { key, value ->
String prefix = JsonOutput.toJson(key)
String suffix = "toJson.error: ${value}"
// log.debug("QuiltPackage.toJson: ${prefix} [${suffix.length()}]")
log.debug("QuiltPackage.toJson: ${prefix} [${suffix.length()}]")
try {
suffix = JsonOutput.toJson(value)
}
Expand Down

0 comments on commit 01daa2a

Please sign in to comment.