Board index » delphi » Getting error code from exception object

Getting error code from exception object

    Hi all!
    As far as I can see there's no error code among exception object
properties. Advise where can I get it, please!

    Thanks in advance!
    Maxim

 

Re:Getting error code from exception object


There is no generic error code. You can determine the type of error by
checking the type of exception and the Message property (and optionally
exception type specific data).

e.g.:

try
  ReadLn(F, S);
except
  on E: EInOutError do
    case E.ErrorCode of
      2: ; // File not found
      3: ; // Invalid file name
      4: ; // Too many open files
      5: ; // Access denied
      100: ; // EOF
      101: ; // Disk full
      106: ; // Invalid input
    else
      // Other
    end;
  on E: Exception do
    // Non I/O exception
end;

"Maxim Dolgov" <c...@mail.ru> schreef in bericht
news:8gamsb$a9a$1@news1.relarn.ru...

Quote
>     Hi all!
>     As far as I can see there's no error code among exception object
> properties. Advise where can I get it, please!

>     Thanks in advance!
>     Maxim

Re:Getting error code from exception object


In article <8gamsb$a9...@news1.relarn.ru>, "Maxim Dolgov" <c...@mail.ru>
writes:

Quote
>    As far as I can see there's no error code among exception object
>properties. Advise where can I get it, please!

Do you mean for an exception that you have declared or for one that has
occurred in the system.

Alan Lloyd
alangll...@aol.com

Other Threads