Conversation
|
Wouldn't it be easier to add the current |
3139825 to
96dd137
Compare
96dd137 to
8ddd694
Compare
|
@nils-a Apologies, I'm having a bit of difficulty understanding what you're suggesting. Could you please explain it? OT: Force pushed because i wanted a cleaner diff. The CommandExecutor appearantly is in mixed mode (LF & CRLF). vscode messes it up. |
|
@JKamsker the currently existing way to handle exceptions is: var app = new CommandApp<DefaultCommand>();
app.Configure(config =>
{
config.SetExceptionHandler(err =>
{
AnsiConsole.WriteException(err);
// or whatever....
});
});I don't quite like the idea of adding another, different way to do exception handling. So: If you need the var app = new CommandApp<DefaultCommand>();
app.Configure(config =>
{
config.SetExceptionHandler((err, resolver) =>
{
var console = (IAnsiConsole)resolver.Resolve(typeof(IAnsiConsole));
console.WriteException(err);
// or whatever....
});
}); |
|
@nils-a Oh yea, that seems like a neat idea! Why haven't i thought about this? 😅 |
Hm. Do you really need different handlers for different Commands? I have the feeling this would make things rather complicated. |
|
Superseded by #1411. |
Reason:
I need a way of handling exceptions while having the typeresolver around. (To log to an implementation of ILogger for e.g)
Unfortunately, the existing exceptionhandler does not provide a way of accessing the ITypeResolver
Usage:
Then register them during startup: