[Proposal] Remove ":" from stacktrace output

30 views
Skip to first unread message

Denis Gorbachev

unread,
Oct 24, 2018, 4:19:59 PM10/24/18
to elixir-lang-core

Current behavior


On error, a stacktrace is displayed:


     stacktrace:
       (elixir) lib/gen_server.ex:924: GenServer.call/3
       test/leverex/loans/loan_server_test.exs:193: (test)


Expected behavior


Same stacktrace, but without colons (":")


     stacktrace:
       (elixir) lib/gen_server.ex:924 GenServer.call/3
       test/leverex/loans/loan_server_test.exs:193 (test)


Rationale


When a single test fails, I copy the last line from stacktrace and re-run the test with mix test.watch {filename}. Currently, I have to remove the ":" manually, which is a slight annoyance, but it add up over time.


Examples


Here are stacktraces of other languages:

JavaScript (NodeJS):

Error: 
    at /Users/cfisher/Git/squashed/execProcess.js:6:17
    at ChildProcess.exithandler (child_process.js:213:5)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:498:12)

Python:


*** print_exception:
Traceback (most recent call last):
  File "<doctest...>", line 10, in <module>
    lumberjack()
  File "<doctest...>", line 4, in lumberjack
    bright_side_of_death()


Go:

Recover from panic: Fake error!
Stack of 402 bytes: goroutine 1 [running]:
main.func·001()
        /Users/mbutcher/Code/Go/src/scratch/stack.go:21 +0xab
runtime.panic(0x80b80, 0x2101fb150)
        /usr/local/Cellar/go/1.2/libexec/src/pkg/runtime/panic.c:248 +0x106
main.inner()
        /Users/mbutcher/Code/Go/src/scratch/stack.go:27 +0x68
main.outer()
        /Users/mbutcher/Code/Go/src/scratch/stack.go:13 +0x1a
main.main()
        /Users/mbutcher/Code/Go/src/scratch/stack.go:9 +0x1a 

OvermindDL1

unread,
Oct 24, 2018, 4:53:32 PM10/24/18
to elixir-lang-core
Maybe the test should accept a filename and line combination with an optional trailing colon instead?

Allen Madsen

unread,
Oct 24, 2018, 11:15:04 PM10/24/18
to elixir-l...@googlegroups.com
The stacktrace line isn't the one you should be running. The test outputs the file and line to run immediately following the test message. Here's an example:

  1) test run/1 raises exception when invalid switch is passed (Mix.Tasks.Conduit.Gen.BrokerTest)
     test/mix/tasks/conduit.gen.broker_test.exs:17
     Expected exception OptionParser.Parserror but got OptionParser.ParseError (1 error found!
     --something-broken : Unknown option)
     code: assert_raise OptionParser.Parserror, fn ->
     stacktrace:
       (elixir) lib/option_parser.ex:231: OptionParser.parse!/2
       (conduit) lib/mix/tasks/conduit.gen.broker.ex:26: Mix.Tasks.Conduit.Gen.Broker.run/1
       test/mix/tasks/conduit.gen.broker_test.exs:18: (test)




--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/64507398-b7ff-4480-a8be-826d46659693%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Denis Gorbachev

unread,
Oct 25, 2018, 4:39:06 AM10/25/18
to elixir-l...@googlegroups.com
Gabriel, yes, it's a good option + non-breaking change.

Allen, it's just more convenient to copy the latest line instead of scrolling up (especially if the stacktrace is long).

You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-core/dBQQ8UBKMpQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAK-y3CtpoZCNGbNGdmPbtg%3DH%2Bgh%2BKJGn%2BYABeKPuqs%3DdgD50SA%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.
--
Denis Gorbachev
Chief Executive Officer @ Spire
Skype: faster-than-wind
https://www.facebook.com/denis.d.gorbachev https://twitter.com/DenGorbachev https://ru.linkedin.com/in/dengorbachev
"Make something people want"
Reply all
Reply to author
Forward
0 new messages