IDE: handle an exception thrown by all options parser.

git-svn-id: trunk@42384 -
This commit is contained in:
juha 2013-08-11 15:40:41 +00:00
parent 960505e772
commit 2a45b388fc
2 changed files with 16 additions and 12 deletions

View File

@ -615,7 +615,7 @@ begin
// Option was not found, try separating the parameter.
// ToDo: figure out the length in a more clever way.
if (Length(aOptAndValue) < 3) or (aOptAndValue[1] <> '-') then
raise Exception.Create('Invalid option & value ' + aOptAndValue);
raise Exception.CreateFmt('Invalid option or value "%s".', [aOptAndValue]);
if aOptAndValue[2] in ['e', 'd', 'u', 'I', 'k', 'o'] then
OptLen := 2
else

View File

@ -116,18 +116,23 @@ procedure TCompilerOtherOptionsFrame.btnAllOptionsClick(Sender: TObject);
var
AllOpts: TfrmAllCompilerOptions;
begin
FOptionsReader.FromCustomOptions(memoCustomOptions.Lines);
AllOpts := TfrmAllCompilerOptions.Create(Nil);
try
AllOpts.OptionsReader:=FOptionsReader;
if AllOpts.ShowModal = mrOK then
begin
// Synchronize with custom options memo
AllOpts.ToCustomOptions(memoCustomOptions.Lines);
memoCustomOptions.Invalidate;
FOptionsReader.FromCustomOptions(memoCustomOptions.Lines);
AllOpts := TfrmAllCompilerOptions.Create(Nil);
try
AllOpts.OptionsReader:=FOptionsReader;
if AllOpts.ShowModal = mrOK then
begin
// Synchronize with custom options memo
AllOpts.ToCustomOptions(memoCustomOptions.Lines);
memoCustomOptions.Invalidate;
end;
finally
AllOpts.Free;
end;
finally
AllOpts.Free;
except
on E: Exception do
ShowMessage('Error parsing custom options: '+E.Message);
end;
end;
@ -613,7 +618,6 @@ begin
CompilerExecutable := EnvironmentOptions.GetParsedCompilerFilename;
if ReadAndParseOptions <> mrOK then
ShowMessage(ErrorMsg);
//FromCustomOptions(FCustomOptions);
except
on E: Exception do
ShowMessage('Error parsing options: '+E.Message);