File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -215,9 +215,23 @@ private static Parser BuildCommandLine()
215215 }
216216 }
217217 } , ( MiddlewareOrder ) ( - 3000 ) ) // MiddlewareOrderInternal.ExceptionHandler so [parse] directive is accurate.
218+ . UseExceptionHandler ( ( ex , context ) => PrintException ( ex , context ) )
218219 . Build ( ) ;
219220 }
220221
222+ private static void PrintException ( Exception ex , InvocationContext context )
223+ {
224+ try
225+ {
226+ Console . Error . WriteLine ( "Unhandled exception: {0}" , ex ) ;
227+ }
228+ catch ( Exception ex2 )
229+ {
230+ Console . Error . WriteLine ( "Unhandled exception: {0}" , ex . Message ) ;
231+ Console . Error . WriteLine ( "Unhandled exception while trying to print string version of the above exception: {0}" , ex2 ) ;
232+ }
233+ }
234+
221235 private static int MainInner ( string [ ] args )
222236 {
223237 try
You can’t perform that action at this time.
0 commit comments