aboutsummaryrefslogtreecommitdiff
path: root/pretty_errors.moon
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-12-15 15:15:03 -0800
committerBruce Hill <bruce@bruce-hill.com>2018-12-15 15:15:10 -0800
commit79881757fb924ce1e776f3d8e429eb3e0e185d18 (patch)
tree73724b0bec4507ae2a7d8185f489a9efcdeeadfe /pretty_errors.moon
parent17fc0a0e3870030dc5db5e14c0a798b65ef7e557 (diff)
Truncating super long error messages.
Diffstat (limited to 'pretty_errors.moon')
-rw-r--r--pretty_errors.moon3
1 files changed, 3 insertions, 0 deletions
diff --git a/pretty_errors.moon b/pretty_errors.moon
index 578aab6..dcffae2 100644
--- a/pretty_errors.moon
+++ b/pretty_errors.moon
@@ -45,6 +45,9 @@ format_error = (err)->
err_msg ..= "\n\027[2m#{fmt_str\format(i)}\027[0;41;30m#{during}\027[0m#{after}"
else
err_msg ..= "\n\027[2m#{fmt_str\format(i)}\027[0;41;30m#{line}\027[0m"
+ if i > err_linenum+1 + 5
+ err_msg ..= "\n ...\n"
+ break
box_width = 70
err_text = "\027[47;31;1m#{string2.wrap(" "..err.error, box_width, 16)\gsub("\n", "\n\027[47;31;1m ")}"