I found this very interesting article about exceptions. You should read “Ten Things (or more) You Might Not Know About Exception Handling in Delphi” (or get it from  Google Cache) and learn why exception inheritance ist important. The same reason applies to the exceptions of the JWSCL. EJwsclSecurityException is the main exception inherited from generic Exception class. All the other exception are inherited from EJwsclSecurityException or another JWSCL exception. The following partial tree shows the inheritance of JWSCL exception classes:

Exception (Delphi)

So if you are going to catch EJwsclSecurityException and e.g. EJwsclAccessDenied you have to catch the second exception first because EJwsclSecurityException would also catch EJwsclAccessDenied.

WRONG order:

  1. try
  2.   …
  3. except
  4.   on E1 : EJwsclSecurityException do
  5.   …
  6.   on E2 : EJwsclAccessDenied do
  7.   …
  8. end;

CORRECT order:

  1. try
  2.   …
  3. except
  4.   on E1 : EJwsclAccessDenied do
  5.   …
  6.   on E2 : EJwsclSecurityException do
  7.   …
  8. end;
Send post as PDF to www.pdf24.org
convert this post to pdf.