On Fri, 2003-11-07 at 12:55, David Butler wrote:
> Sorry, I should have guessed. Yes, it basically takes the OS error and
> raises some exception. The exception message is the OS error message
> as returned by an OS function call.

Here's a basic implementation that works for me (*):

const
  StrOSError : string = 'System error (number %d).'+LineEnding+'%s';
                                                                                
type
  EOSError = class(Exception)
  end;

procedure RaiseLastOSError;
var
  LError: integer;
begin
  LError := GetLastError;
  raise EOSError.CreateFmt(StrOSError,[LError,StrError(LError)]);
end;

(*) for linux, GetLastError is not defined in system.pp. It should be
(to be Delphi compatible), and this works:

function GetLastError: Integer;
begin
  Result := fpGetErrno;
end;

johannes
-- 
http://www.sipsolutions.de/
GnuPG key: http://www.sipsolutions.de/keys/JohannesBerg.asc
  Key-ID: 9AB78CA5 Johannes Berg <[EMAIL PROTECTED]>
  Fingerprint = AD02 0176 4E29 C137 1DF6 08D2 FC44 CF86 9AB7 8CA5

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to