Skip to content

Commit

Permalink
Truncate max size exceeded error message (nextflow-io#4644)
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Co-authored-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Niklas Schandry <niklas@bio.lmu.de>
  • Loading branch information
2 people authored and nschan committed Apr 3, 2024
1 parent 517c351 commit 42c43c4
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,11 @@ class TowerJsonGenerator extends DefaultJsonGenerator {
final key = stack.join('.')
final max = scheme.get(key)
if( seq!=null && max && seq.length()>max ) {
log.warn "Tower request field `$key` exceeds expected size | offending value: `$seq`, size: ${seq.size()} (max: $max)"
return seq.toString().substring(0,max)
final result = seq.toString().substring(0,max)
// show only the first 100 chars in the log as a preview
final preview = result.length()>100 ? result.substring(0,100) + '(truncated)' : result
log.warn "Tower request field `$key` exceeds expected size | offending value: `${preview}`, size: ${seq.size()} (max: $max)"
return result
}
return seq
}
Expand Down

0 comments on commit 42c43c4

Please sign in to comment.