Sometimes stack trace has lots of irrelevant lines in error messages in console.
In example below I made mistake, notice how the relevant lines get lost in the huge stack trace:
alex$ crystal play.cr
Unhandled exception: expecting int or float but was Null at 1:6 (JSON::ParseException)
from /apps/crystal-0.32.0-1/src/json/pull_parser.cr:555:5 in 'parse_exception'
from /apps/crystal-0.32.0-1/src/json/pull_parser.cr:155:7 in 'read_float'
from /apps/crystal-0.32.0-1/src/json/from_json.cr:110:5 in 'new'
from /apps/crystal-0.32.0-1/src/json/from_json.cr:136:11 in 'new'
from /apps/crystal-0.32.0-1/src/json/from_json.cr:13:3 in 'from_json'
from lib/helpers.cr:7:5 in 'load'
from play.cr:5:1 in '__crystal_main'
from /apps/crystal-0.32.0-1/src/crystal/main.cr:97:5 in 'main_user_code'
from /apps/crystal-0.32.0-1/src/crystal/main.cr:86:7 in 'main'
from /apps/crystal-0.32.0-1/src/crystal/main.cr:106:3 in 'main'
The relevant part is this:
alex$ crystal play.cr
Unhandled exception: expecting int or float but was Null at 1:6 (JSON::ParseException)
from lib/helpers.cr:7:5 in 'load'
from play.cr:5:1 in '__crystal_main'
Proposal:
Color stack trace lines that belong to crystal core with gray colour. The error message would still contain the full information and it will be easier to focus on the relevant part.
Alternative solution would be to highlight those two lines, but silencing irrelevant part with grey color seems preferable as it would keep the console more quiet.
The core developers that need those lines could set flag that disables that mode on their machines.