quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.59k stars 2.63k forks source link

Qute error reporting is too verbose #31325

Open FroMage opened 1 year ago

FroMage commented 1 year ago

Describe the bug

I have 23 errors, and this is the log:

https://gist.github.com/FroMage/efe4825da693adcfa783164fac608dd7

It looks like it's displaying the list of errors three times, and it's also displaying each error twice due to them being stuffed into Suppressed.

Can we tweak the error reporting so that we only report the 23 errors once and no exception?

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

quarkus-bot[bot] commented 1 year ago

/cc @mkouba (qute)

mkouba commented 1 year ago

This issue duplicates https://github.com/quarkusio/quarkus/issues/20583.

The error message is IMO well-arranged:

    [error]: Build step io.quarkus.qute.deployment.QuteProcessor#processTemplateErrors threw an exception: io.quarkus.qute.TemplateException: Found incorrect expressions (23):
    [1] Application/talk.html:9:5 - {user}: Only type-safe expressions are allowed in the checked template defined via: rest.Application$Templates.talk(); an expression must be based on a checked template parameter [displayFullSchedule, talk], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)
    [2] Application/organiser.html:39:9 - {user}: Only type-safe expressions are allowed in the checked template defined via: rest.Application$Templates.organiser(); an expression must be based on a checked template parameter [orga], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)
    [3] Application/live.html:32:22 - {trackItem.title.urlPathEncode()}: Property/method [urlPathEncode()] not found on class [java.lang.@NotBlank String] nor handled by an extension method
    [4] Application/fishMarket.html:7:31 - {day.format('yyyy-MM-dd')}: Property/method [format('yyyy-MM-dd')] not found on class [java.util.Date] nor handled by an extension method
    [5] Application/fishMarket.html:18:4 - {models.Slot.findMultiPerDay(day)}: Only type-safe expressions are allowed in the checked template defined via: rest.Application$Templates.fishMarket(); an expression must be based on a checked template parameter [tracksForDay, day], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)
    [6] Application/fishMarket.html:20:6 - {slot.getTalksPerTrack(track)}: Only type-safe expressions are allowed in the checked template defined via: rest.Application$Templates.fishMarket(); an expression must be based on a checked template parameter [tracksForDay, day], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)
    [7] Application/fishMarket.html:24:9 - {talk.speakers}: Only type-safe expressions are allowed in the checked template defined via: rest.Application$Templates.fishMarket(); an expression must be based on a checked template parameter [tracksForDay, day], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)
    [8] Application/fishMarket.html:26:15 - {speaker.id}: Only type-safe expressions are allowed in the checked template defined via: rest.Application$Templates.fishMarket(); an expression must be based on a checked template parameter [tracksForDay, day], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)
    [9] Application/fishMarket.html:27:15 - {speaker.firstName}: Only type-safe expressions are allowed in the checked template defined via: rest.Application$Templates.fishMarket(); an expression must be based on a checked template parameter [tracksForDay, day], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)
    [10] Application/fishMarket.html:27:35 - {speaker.lastName}: Only type-safe expressions are allowed in the checked template defined via: rest.Application$Templates.fishMarket(); an expression must be based on a checked template parameter [tracksForDay, day], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)
    [11] Application/fishMarket.html:29:13 - {talk.title}: Only type-safe expressions are allowed in the checked template defined via: rest.Application$Templates.fishMarket(); an expression must be based on a checked template parameter [tracksForDay, day], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)
    [12] Application/schedule.html:34:58 - {day.format('EEEE dd MMMM yyyy')}: Property/method [format('EEEE dd MMMM yyyy')] not found on class [java.util.Date] nor handled by an extension method
    [13] Application/schedule.html:35:57 - {day.format('EEEE dd').replace(' ','<br>').raw()}: Property/method [format('EEEE dd')] not found on class [java.util.Date] nor handled by an extension method
    [14] Application/schedule.html:44:10 - {languages/}: Only type-safe expressions are allowed in the checked template defined via: rest.Application$Templates.schedule(); an expression must be based on a checked template parameter [tracksPerDays, themes, displayNewSpeakers, types, languages, displayTalks, displayFullSchedule, days, tracks, levels], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)
    [15] Application/schedule.html:44:10 - {filterForTalks.themes:(themes).levels:(levels).types:(types).languages:(languages/)}: Only type-safe expressions are allowed in the checked template defined via: rest.Application$Templates.schedule(); an expression must be based on a checked template parameter [tracksPerDays, themes, displayNewSpeakers, types, languages, displayTalks, displayFullSchedule, days, tracks, levels], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)
    [16] Application/schedule.html:68:29 - {user}: Only type-safe expressions are allowed in the checked template defined via: rest.Application$Templates.schedule(); an expression must be based on a checked template parameter [tracksPerDays, themes, displayNewSpeakers, types, languages, displayTalks, displayFullSchedule, days, tracks, levels], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)
    [17] Application/schedule.html:71:29 - {user}: Only type-safe expressions are allowed in the checked template defined via: rest.Application$Templates.schedule(); an expression must be based on a checked template parameter [tracksPerDays, themes, displayNewSpeakers, types, languages, displayTalks, displayFullSchedule, days, tracks, levels], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)
    [18] Application/schedule.html:77:29 - {user}: Only type-safe expressions are allowed in the checked template defined via: rest.Application$Templates.schedule(); an expression must be based on a checked template parameter [tracksPerDays, themes, displayNewSpeakers, types, languages, displayTalks, displayFullSchedule, days, tracks, levels], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)
    [19] Application/schedule.html:79:29 - {user}: Only type-safe expressions are allowed in the checked template defined via: rest.Application$Templates.schedule(); an expression must be based on a checked template parameter [tracksPerDays, themes, displayNewSpeakers, types, languages, displayTalks, displayFullSchedule, days, tracks, levels], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)
    [20] Application/scheduleSuperSecret.html:21:58 - {day.format('EEEE dd MMMM yyyy')}: Property/method [format('EEEE dd MMMM yyyy')] not found on class [java.util.Date] nor handled by an extension method
    [21] Application/scheduleSuperSecret.html:22:57 - {day.format('EEEE dd').replace(' ','<br>').raw()}: Property/method [format('EEEE dd')] not found on class [java.util.Date] nor handled by an extension method
    [22] Application/scheduleSuperSecret.html:30:6 - {languages/}:ype-safe expressions are allowed in the checked template defined via: rest.Application$Templates.scheduleSuperSecret(); an expression must be based on a checked template parameter [tracksPerDays, themes, types, languages, days, tracks, levels], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)
    [23] Application/scheduleSuperSecret.html:30:6 - {filterForTalks.themes:(themes).levels:(levels).types:(types).languages:(languages/)}: Only type-safe expressions are allowed in the checked template defined via: rest.Application$Templates.scheduleSuperSecret(); an expression must be based on a checked template parameter [tracksPerDays, themes, types, languages, days, tracks, levels], or bound via a param declaration, or the requirement must be relaxed via @CheckedTemplate(requireTypeSafeExpressions = false)

And this is my comment about suppressed exceptions.

FroMage commented 1 year ago

AFAIK that's the standard way how Quarkus handles suppressed exceptions. They're not useful in the console but since every TemplateException holds some info about the "origin", i.e. line, template, ..., it could be useful for other tools.

Well, can't we find a way to not report them in this case? It makes it really hard to see the nice errors already reported.

mkouba commented 1 year ago

AFAIK that's the standard way how Quarkus handles suppressed exceptions. They're not useful in the console but since every TemplateException holds some info about the "origin", i.e. line, template, ..., it could be useful for other tools.

Well, can't we find a way to not report them in this case? It makes it really hard to see the nice errors already reported.

I have no idea. In any case, you can see the error message mentioned in the previous comment at the top of the stack and just ignore all the junk below.

FroMage commented 1 year ago

I have no idea. In any case, you can see the error message mentioned in the previous comment at the top of the stack and just ignore all the junk below.

No, this is terrible UX. We can't do that to our users, we have to do better.

mkouba commented 1 year ago

I have no idea. In any case, you can see the error message mentioned in the previous comment at the top of the stack and just ignore all the junk below.

No, this is terrible UX. We can't do that to our users, we have to do better.

Then we should just give up on stack traces in general because it's not a very good UX ;-).

In any case, feel free to propose a better solution.

FroMage commented 1 year ago

Then we should just give up on stack traces in general because it's not a very good UX ;-).

Well, these are different, because they give excellent error messages, then produce a shit load of suppressed exceptions that hide them.

In any case, feel free to propose a better solution.

We should have a marker interface or annotation on exceptions such as the Qute one, so that the code responsible for printing the exception does not print the stack trace or its suppressed exceptions. The error message is what we want. The rest is gargabe.

gastaldi commented 3 weeks ago

Closing as the current solution seems okay for now.

FroMage commented 3 weeks ago

OK for whom?

gastaldi commented 3 weeks ago

OK for whom?

I thought it is covered by the changes introduced in https://github.com/quarkusio/quarkus/pull/25810? If I misunderstood please reopen this issue then

FroMage commented 3 weeks ago

No, these changes were made before I reported this issue.