Skip to content

Commit

Permalink
Fix formatting of error message
Browse files Browse the repository at this point in the history
Signed-off-by: Mahesh Binzer-Panchal <mahesh.binzer-panchal@nbis.se>
  • Loading branch information
mahesh-panchal committed Jan 23, 2024
1 parent a1e3319 commit e3ff2ce
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1219,8 +1219,16 @@ class TaskProcessor {
else {
if( task?.source ) {
message << "Source block:"
task.source.stripIndent(true).eachLine {
message << " $it"
def ws_check = task.source =~ /\n(\s+)['"]{3}\n/
if( ws_check.find() ){
def whitespace = ws_check[0][1]
task.source.eachLine {
message << " ${it.startsWith(whitespace) ? it.substring(whitespace.size()) : it}"
}
} else {
task.source.eachLine {
message << " $it"
}
}
}

Expand Down Expand Up @@ -1290,9 +1298,10 @@ class TaskProcessor {
else
message = err0(error.cause)

message.eachLine {
result << ' ' << it << '\n'
}
result
.append(' ')
.append(message)
.append('\n')
.toString()
}
Expand Down

0 comments on commit e3ff2ce

Please sign in to comment.