Skip to content

Preserve Python's native exception rendering in the custom traceback printer #106

Description

@coderabbitai

Summary

The custom exception printer in promising/errors.py (around lines 168–255) reconstructs traceback output from extracted frames plus a final type: value line. This bypasses Python's stdlib handling for:

  • Exception.add_note() notes
  • ExceptionGroup structure
  • SyntaxError detail rendering
  • Future traceback features added to the stdlib

Once the custom hook is active, that diagnostic information disappears for promising-linked failures.

Suggested Fix

Base the tail rendering on traceback.TracebackException / traceback.print_exception and layer the promising frames around that instead of rebuilding the tail manually. For example, build a traceback.TracebackException from the original exc_type/exc_value/exc_tb and delegate the core rendering to traceback.TracebackException.format() / traceback.print_exception, while inserting promising context frames by merging or wrapping the TracebackException stack with promising_context.get_trace(ancestors_first=True) output.

References

Reported by @coderabbitai, requested by @teremterem.

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions