File tree Expand file tree Collapse file tree
src/MediaConverters/MediaConverters.Tool Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ public readonly record struct MediaConverterErrorCode
4040
4141 public static readonly ErrorCode GdiException = new ( 1005 , "Gdi exception" ) ;
4242
43+ public static readonly ErrorCode UnknownException = new ( 1006 , "Unknown exception" ) ;
44+
4345 /// <summary>
4446 /// 错误代码
4547 /// </summary>
Original file line number Diff line number Diff line change @@ -87,11 +87,11 @@ internal static async Task<ErrorCode> RunAsync(Options options)
8787 var errorMessage = $ "Failed to convert image file '{ inputFile . FullName } '. Reason: { imageFileOptimizationResult . FailureReason } ";
8888 if ( imageFileOptimizationResult . Exception is { } exception )
8989 {
90- errorMessage += $ " Exception: { exception } ";
90+ errorMessage += $ ". Exception: { exception } ";
9191 }
9292
9393 Console . Error . WriteLine ( errorMessage ) ;
94-
94+
9595 switch ( imageFileOptimizationResult . FailureReason )
9696 {
9797 case ImageFileOptimizationFailureReason . Ok :
@@ -107,8 +107,10 @@ internal static async Task<ErrorCode> RunAsync(Options options)
107107 return ErrorCode . NotSupported ;
108108 case ImageFileOptimizationFailureReason . GdiException :
109109 return ErrorCode . GdiException ;
110+ case ImageFileOptimizationFailureReason . Exception :
111+ return ErrorCode . UnknownException ;
110112 default :
111- throw new ArgumentOutOfRangeException ( ) ;
113+ throw new ArgumentOutOfRangeException ( $ "Unknown FailureReason. FailureReason= { imageFileOptimizationResult . FailureReason } " ) ;
112114 }
113115
114116 return ErrorCode . UnknownError ;
You can’t perform that action at this time.
0 commit comments