I want to add appropriate exception handling with useful messages when loading and saving various descendants of TGraphic using the LoadFromFile and SaveToFile procedures.
The files are selected using the standard Delphi OpenDialog (for LoadFromFile) and SaveDialog (for SaveToFile).
What exceptions do I need to handle? I have been reading the help files and other sources, but am having difficulty deciding which are the most appropriate exceptions to catch. Maybe I should be using the EFCreateError, EFOpenError, or more generic EFileStreamError exceptions, or maybe EInOutError?
Can anybody advise on what I should be putting at ??? in:
I am using Delphi 7. Backwards compatibility with earlier versions of Delphi is not required.
Many thanks for spending the time to read this (and even more thanks if you reply!)
The files are selected using the standard Delphi OpenDialog (for LoadFromFile) and SaveDialog (for SaveToFile).
What exceptions do I need to handle? I have been reading the help files and other sources, but am having difficulty deciding which are the most appropriate exceptions to catch. Maybe I should be using the EFCreateError, EFOpenError, or more generic EFileStreamError exceptions, or maybe EInOutError?
Can anybody advise on what I should be putting at ??? in:
Code:
try
LoadFromFile(FileName);
except
???
end;
try
SaveToFile(FileName);
except
???
end;
I am using Delphi 7. Backwards compatibility with earlier versions of Delphi is not required.
Many thanks for spending the time to read this (and even more thanks if you reply!)