Browse Source

Fixed UICatalog to not eat exceptions

Tig Kindel 1 year ago
parent
commit
0330c1d0b1
1 changed files with 6 additions and 12 deletions
  1. 6 12
      UICatalog/UICatalog.cs

+ 6 - 12
UICatalog/UICatalog.cs

@@ -63,6 +63,8 @@ class UICatalogApp {
 		/* etc. */
 		/* etc. */
 	}
 	}
 
 
+	static Options _options;
+
 	static int Main (string [] args)
 	static int Main (string [] args)
 	{
 	{
 		Console.OutputEncoding = Encoding.Default;
 		Console.OutputEncoding = Encoding.Default;
@@ -101,21 +103,13 @@ class UICatalogApp {
 				Scenario = context.ParseResult.GetValueForArgument (scenarioArgument),
 				Scenario = context.ParseResult.GetValueForArgument (scenarioArgument),
 				/* etc. */
 				/* etc. */
 			};
 			};
-			context.ExitCode = CommandWrapper (options);
+			// See https://github.com/dotnet/command-line-api/issues/796 for the rationale behind this hackery
+			_options = options; ;
 		});
 		});
 
 
-		return rootCommand.Invoke (args);
-	}
+		rootCommand.Invoke (args);
 
 
-	// See https://github.com/dotnet/command-line-api/issues/796 for the rationale behind this hackery
-	static int CommandWrapper (Options options)
-	{
-		try {
-			UICatalogMain (options);
-		} catch (Exception e) {
-			Console.WriteLine (e.ToString());
-			return 1;
-		}
+		UICatalogMain (_options);
 		return 0;
 		return 0;
 	}
 	}