Flynet Viewer .NET Programmer's Reference

Exceptions

Exceptions

Previous topic Next topic  

Exceptions

Previous topic Next topic  

The exception objects are only for the .Net class. They are derived from Application.Exception which in turn is derived from System.Exception.

 

The SCRecogException exception is intended to deal with screen application and screen transition errors. The SCException exception is intended to deal with errors specific to the FSCProLib class library.

 

This means that applications can be designed to catch exceptions at a lower, more local level to deal with screen and application logic related exceptions. A higher level deals with any problems related to the FSCProLib class library. Finally at an even higher level a catch using System.Exception can trap any potentially fatal errors and allow a clean exit.

 

The following C# code gives an example of the use of exceptions. A higher level method called "UpperControl" has a try-catch statement. If the exception is not caught within the "NavigateControl" method, then it would be caught by the "UpperControl" method.

 

private void UpperControl()

{

try

{

NavigateControl();

}

catch(System.Exception e)

{

Debug.WriteLine("Critical Error: "+e.Message);

}

}

private void NavigateControl()

{

HostConnection con = new HostConnection();

HostScreen scr;

try

{

con.hostName = "Insure";

con.connect("standard");

scr = con.getScreen();

scr.waitForScreen("Start", 5000);

scr.putKeys("simmy");

scr.putCommand("[enter]");

scr.waitForScreen("SysSelect", 5000);

con.disconnect("stop");

}

catch(FSCProLib.SCRecogException e)

{

Debug.WriteLine("Screen navigation error: "+e.Message);

}

catch(FSCProLib.SCException e)

{

Debug.WriteLine("FSCProLib internal error: "+e.Message);

}

}

 

 


© 2016 Inventu Corporation, Flynet LTD