Skip to content

Commit

Permalink
Improve print_exception()
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyash-b committed Oct 24, 2023
1 parent 054b43c commit c9be473
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/stdlib.ngs
Original file line number Diff line number Diff line change
Expand Up @@ -7397,6 +7397,9 @@ section "Lines" {
F framed(lines:Lines) {
not(lines) returns lines
m = lines.map(len).max()
if m > 80 {
return lines.mapo("*** $X")
}
border = '+' + ('-' * (m+2)) + '+'
collector/Lines() {
collect(border)
Expand Down Expand Up @@ -7624,6 +7627,12 @@ F print_exception(e:Exception, level:Int = 0, parent:Exception = null, echo=echo
echo(m.framed())
}

# TODO: unhack
if (e is ProcessFail) and ('process' in e) and ('stderr' in e.process) and (e.process.stderr) {
echo("stderr follows:")
echo(e.process.stderr.limit(16384))
}

}

exit_hook = Hook()
Expand Down

0 comments on commit c9be473

Please sign in to comment.