Skip to content

RFC: Remove 'Stack trace' from break loop messages (???)#6429

Closed
fingolfin wants to merge 1 commit into
masterfrom
mh/no-stacktrace-in-breakloop-msg
Closed

RFC: Remove 'Stack trace' from break loop messages (???)#6429
fingolfin wants to merge 1 commit into
masterfrom
mh/no-stacktrace-in-breakloop-msg

Conversation

@fingolfin

Copy link
Copy Markdown
Member

I've added this in PR #6257 but now am not so sure anymore I like it, and the way it is inserted. See this comment on PR #6416.

@fingolfin fingolfin added release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes topic: error handling labels Jun 6, 2026

@ThomasBreuer ThomasBreuer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the format was inspired by that of the error messages in Julia, where the specific message text is followed by a line Stacktrace: (not Stack trace:) and then the description of the call stack, with numbers for the levels.

I have no preference for keeping the line in question or leaving it out.

@codecov

codecov Bot commented Jun 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.87%. Comparing base (8187e9e) to head (8dc2e93).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6429   +/-   ##
=======================================
  Coverage   78.87%   78.87%           
=======================================
  Files         685      685           
  Lines      293550   293547    -3     
  Branches     8672     8672           
=======================================
  Hits       231530   231530           
+ Misses      60211    60209    -2     
+ Partials     1809     1808    -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fingolfin fingolfin changed the title Remove 'Stack trace' from break loop messages RFC: Remove 'Stack trace' from break loop messages (???) Jun 8, 2026
@fingolfin

Copy link
Copy Markdown
Member Author

Sorry, I was unclear: I am not necessarily saying we should merge this PR. I am just unsure if printing this line is good, bad or neutral. Personally I don't mind it an am also used to something like it from e.g. Julia. But I feel it kinda "slipped in under the radar" with PR #6257. So this is now an attempt to hear what others think about it: keep it? remove it again? or maybe adjust it?

Comment thread lib/error.g
Comment on lines -304 to -306
if OnBreak = Where or OnBreak = WhereWithVars then
PrintTo(ERROR_OUTPUT, "Stack trace:\n");
fi;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note also this implementation is a bit wonky. Perhaps Stack trace: should always be printed in Where?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah and this also breaks when certain packages are loaded: e.g. for me Browse is autoloaded, and therefore I never see the Stack trace::

gap> Display(OnBreak);
# /Users/mhorn/Projekte/GAP/gap/pkg/browse/lib/ncurses.gi:437
function (  )
    if not NCurses.isendwin(  ) then
        NCurses.endwin(  );
    fi;
    OnBreakSavedByBrowse(  );
    return;
end

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See PR #6432 for an attempt to clean this up.

Comment thread doc/ref/debug.xml
gap> IsNormal(2,2);
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `IsNormal' on 2 arguments
Stack trace:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is an example of Stack trace: with an "empty" stack trace; this is what first lead to me questioning whether this line is helpful or not...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also addressed by PR #6432

@fingolfin fingolfin force-pushed the mh/no-stacktrace-in-breakloop-msg branch from a51536f to 8dc2e93 Compare June 8, 2026 09:16
@stertooy

stertooy commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

I prefer the message staying, at least when it's actually followed by a stack trace. Reason being that I think it might make errors clearer for users that have little programming experience.

If I didn't know what a stack trace was and I saw this:

Error, Assert: <cond> must be 'true' or 'false' (not the integer 1)
*[1] Assert( 0, 1 );
   @ *stdin*:44
<function "f">( <arguments> )

Then I'd probably be unsure whether this is all one big error message or not, and what to do with it. Whereas if I saw

Error, Assert: <cond> must be 'true' or 'false' (not the integer 1)
Stack trace:
*[1] Assert( 0, 1 );
   @ *stdin*:44
<function "f">( <arguments> )

I'd know that the first line is the actual error message, and everything below is something that's called a "stack trace", which I could then google.

@lgoettgens

Copy link
Copy Markdown
Member

I am with @stertooy here: Keeping the heading would be great. And #6432 seems to fix the edge cases where it does not behave as wished for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes topic: error handling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants