Skip to content

Commit

Permalink
Improve display of cmdline argument parsing errors
Browse files Browse the repository at this point in the history
Do not include the list of all command line options (which by now is
very long) with an error message when validation of a parsed argument
value fails.

This patch only affects errors from more complex validation of certain
preferences, such as 'ignore' predicates. Such errors are produced very
rarely to begin with - more common errors, such as unknown argument,
invalid argument type (string, instead of a number), are still displayed
as before. It may make sense to dispaly a list of all options with an
"unkown argument" error but it does not make sense with more complex
logic errors.

Without this change, some of the command line argument validation errors
end up in the GUI, displaying the long list of options in an overflowing
message box, with the actual error obscured or not visible.
  • Loading branch information
tleedjarv committed Sep 23, 2023
1 parent 893b380 commit b72c007
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ubase/prefs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ let processCmdLine usage hook =
try
Uarg.parse argspecs anonfun (oneLineDocs usage)
with IllegalValue str ->
raise(Util.Fatal(Printf.sprintf "%s \n%s\n" (oneLineDocs usage) str))
raise (Util.Fatal str)

let parseCmdLine usage =
processCmdLine usage (fun _ sp -> sp)
Expand Down

0 comments on commit b72c007

Please sign in to comment.