quarkus: provide source file context for exception message

Description

saw https://github.com/laech/java-stacksrc today

turns:

org.opentest4j.AssertionFailedError: expected: <hello> but was: <hi>
	at org.junit...
	at com.example.MyTest.hello(MyTest.java:24)
	...

into

org.opentest4j.AssertionFailedError: expected: <hello> but was: <hi>
	at org.junit...
	at com.example.MyTest.hello(MyTest.java:24)

	   22    @Test
	   23    void compareStrings() {
	-> 24      assertEquals("hello", "hi");
	   25    }

	...

would be awesome to hook into quarkus dev and have that printed in logs and on error page with option to turn on/off.

Implementation ideas

The functionality is dead simple: https://github.com/laech/java-stacksrc/tree/main/core/src/main/java/nz/lae/stacksrc

3 files that just decorate any java stacktrace.

could even consider to just copy it in to avoid extra dependency.

hook in to JBoss logging of errors and the error page.

About this issue

  • Original URL
  • State: open
  • Created 8 months ago
  • Comments: 20 (20 by maintainers)

Commits related to this issue

Most upvoted comments

I’m thinking of just copying the code so we can do whatever we like whenever we like