![]() |
![]() |
Attachmate e-Vantage Airlines SDK uses exceptions to indicate error conditions. All of the Attachmate e-Vantage Airlines SDK exception classes extend java.lang.Exception. This topic provides general information about catching exceptions.
For details on the SDK exception classes, see the Attachmate e-Vantage Airlines SDK Javadoc (or click a specific exception class in the example below).
It is recommended that you include catch blocks in methods that create SDK objects (as shown in the following examples). Several SDK methods throw exceptions, and some, such as the putString method, throw several exceptions.
Examples of how to code exceptions for each of the supported development environments are provided in Handling Exceptions in Java, Handling Exceptions in ASP, and Handling Exceptions in Visual C++ below.
The following Java example includes a catch block for each exception thrown by the putString method:
try { String inText = "PASSWORD"; int inRow = 1; int inColumn = 1; int numCharsPut = m_ScreenUts.putString (inText, inRow, inColumn ); } catch(ProtectedFieldException e) { System.err.println("ProtectedFieldException " ); return; } catch(InputInhibitedException e) { System.err.println("InputInhibitedException " ); return; } catch(TruncatedException e) { System.err.println("TruncatedException " ); return; }
The following ASP (VBScript) example includes a catch block for an exception thrown when opening a host session:
On Error Resume Next Err.Clear CatchExceptionError() Response.Write "<br>Exceptions will fall through the<br>" Response.Write "code if the On Error Resume Next is<br>" Response.Write "set, then catch them in the subroutine.<br>" set SessionObj = CreateObject("SessionLoader.SessionLoader") set screenObj = SessionObj.requestScreen("User","Password","WebView") Response.Write " Open returns " & screenObj.Open() & "<br>" screenObj.waitForCursor 3,18,250 Response.Write "<br>--><br>" & screenObj.getText() & "<br><--<br>" CatchExceptionError() screenObj.putString "bogus", 13,37 Response.Write "<br>--><br>" & screenObj.getText() & "<br><--<br>" screenObj.Close() CatchExceptionError() Response.Write "<br>Done<br>" Sub CatchExceptionError() If Err <> 0 Then Response.Write "<br>!!! <br>" Response.Write "!!! <br>" Response.Write "!!! Exception error number: " & Err.Number & "<br>" Response.Write "!!! Exception description: " & Err.Description & "<br>" Response.Write "!!! <br>" Response.Write "!!! <br><br>" end if screenObj.waitHostQuiet 2000,8000 Err.Clear End Sub
The following Visual C++ example includes a catch block for the exception thrown by the waitHostQuiet method:
int inSettleTime = 1000; int wtTime = 3000; TRY { this->m_screenObj.waitHostQuiet(inSettleTime, wtTime); } CATCH_ALL(e) { AfxMessageBox("TimedOutException " ); return; } END_CATCH_ALL
![]() |
|
![]() |
Common Tasks |
![]() |
SDK Objects, Overview |
![]() |
Handling Events |
![]() |