Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty Stack Trace message without catch exception. #1692

Open
netpyoung opened this issue Nov 21, 2024 · 0 comments
Open

Pretty Stack Trace message without catch exception. #1692

netpyoung opened this issue Nov 21, 2024 · 0 comments

Comments

@netpyoung
Copy link

Is your feature request related to a problem? Please describe.

What I want, print pretty stack trace message without thorw/catch.

  internal sealed class PatchNoteMakerException : Exception
  {
      public override string StackTrace { get; }

      public PatchNoteMakerException(string message) : base(message)
      {
          StackTrace = Environment.StackTrace;
       }
   }

PatchNoteMakerException eee = new PatchNoteMakerException("This is a test exception!");
AnsiConsole.WriteException(eee);

// console output:
// PatchNoteMakerException: This is a test exception!

Describe the solution you'd like

Currently It seems there is no inject point to pass stack info or render info to output.
I found class CommandAppException but constructor is internal.
It will be good some class to pass stack trace information then print their information without try/catch.

PatchNoteMakerException : SomeExceptionClass
            StackTrace stackTraceObj = new StackTrace(true);
            IRenderable renderable = this.GetRenderable(ExceptionFormats.ShortenEverything);

Describe alternatives you've considered

Additional context


Please upvote 👍 this issue if you are interested in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo 🕑
Development

No branches or pull requests

1 participant