File tree 1 file changed +21
-12
lines changed
1 file changed +21
-12
lines changed Original file line number Diff line number Diff line change @@ -6,23 +6,32 @@ internal static class Program
6
6
{
7
7
private static int Main ( string [ ] args )
8
8
{
9
- var launcherOptions = Parser . Default . ParseArguments < LauncherOptions > ( args ) . Value ;
10
- if ( launcherOptions == null )
9
+ try
11
10
{
12
- Console . WriteLine ( "参数错误,解析失败" ) ;
13
- return 1 ;
14
- }
11
+ var launcherOptions = Parser . Default . ParseArguments < LauncherOptions > ( args ) . Value ;
12
+ if ( launcherOptions == null )
13
+ {
14
+ Console . WriteLine ( "参数错误,解析失败" ) ;
15
+ throw new Exception ( "参数错误,解析失败" ) ;
16
+ }
17
+
18
+ if ( ! Enum . TryParse < ModeType > ( launcherOptions . Mode , true , out var modeType ) )
19
+ {
20
+ Console . WriteLine ( "不支持的运行模式" ) ;
21
+ throw new Exception ( "不支持的运行模式" ) ;
22
+ }
15
23
16
- if ( ! Enum . TryParse < ModeType > ( launcherOptions . Mode , true , out var modeType ) )
24
+ ProtoBufMessageHandler . Start ( launcherOptions , modeType ) ;
25
+ Console . WriteLine ( "导出成功,请查看日志" ) ;
26
+ }
27
+ catch ( Exception e )
17
28
{
18
- Console . WriteLine ( "不支持的运行模式" ) ;
19
- return 1 ;
29
+ Console . WriteLine ( "导出失败,请检查错误信息" ) ;
30
+ Console . WriteLine ( e ) ;
31
+ Console . ReadKey ( ) ;
32
+ throw ;
20
33
}
21
34
22
- ProtoBufMessageHandler . Start ( launcherOptions , modeType ) ;
23
-
24
- Console . WriteLine ( "导出成功,按任意键退出" ) ;
25
- Console . ReadKey ( ) ;
26
35
return 0 ;
27
36
}
28
37
}
You can’t perform that action at this time.
0 commit comments