Browse Source

* simplify code: simply raising an exception is enough, it's not necessary to call ShowException and Terminate

git-svn-id: trunk@45595 -
svenbarth 5 years ago
parent
commit
1e1c17cb61
1 changed files with 4 additions and 15 deletions
  1. 4 15
      utils/ihxutil/ihxutil.lpr

+ 4 - 15
utils/ihxutil/ihxutil.lpr

@@ -78,11 +78,8 @@ begin
 
   // quick check parameters
   ErrorMsg:=CheckOptions(ShortOptions, LongOptions);
-  if ErrorMsg<>'' then begin
-    ShowException(Exception.Create(ErrorMsg));
-    Terminate;
-    Exit;
-  end;
+  if ErrorMsg<>'' then
+    raise Exception.Create(ErrorMsg);
 
   // parse parameters
   if HasOption('h', 'help') then begin
@@ -109,17 +106,9 @@ begin
 
   NonOptions := GetNonOptions(ShortOptions, LongOptions);
   if Length(NonOptions) = 0 then
-  begin
-    ShowException(Exception.Create('Missing input file'));
-    Terminate;
-    Exit;
-  end;
+    raise Exception.Create('Missing input file');
   if Length(NonOptions) > 2 then
-  begin
-    ShowException(Exception.Create('Too many files specified'));
-    Terminate;
-    Exit;
-  end;
+    raise Exception.Create('Too many files specified');
   FInputFileName := NonOptions[0];
   if Length(NonOptions) >= 2 then
     FOutputFileName := NonOptions[1]