Code: Select all
begin
try
try
try
StrToFloat('123.45.');
except
Exception.RaiseOuterException(Exception.Create('Failed to load some settings'));
end;
except
Exception.RaiseOuterException(Exception.Create('Failed to load project file'));
end;
except
on E: Exception do
Writeln(E.ToString);
end;
Readln;
end.
I've started to use Exception.RaiseOuterException and Exception.ToString like above,
to give informative error message to app users.
This code gives error messages below.
"Failed to load project file
Failed to load some settings
'123.45.' is not a valid floating point value"
I used to concatenate Exception message by hand, but it's done by Exception.ToString automatically.
I think it's handy and seems good practice.
But with madExcept enabled, E.ToString gives "Failed to load project file" only.
Can you keep Exception's nested structure while madExcept hook being enabled ?
Could you fix this problem ?