Try/Catch Block
try {
... your code here ...
}
catch ( Exception e ) { ... your code here ... }
The way to catch an exception or error is with a try/catch block. This can be placed around any piece of code. Note that any variables declared within the try/catch block are only accessible from within the block. To make a variable visible in and out of a try/catch block, declare the variable outside the try/catch block. For example:
	try {
		long x = 5;
		x = x * 10;   // ok
	} catch ( Exception e ) {}
	x = x + 9;   // error! undefined variable!

The variable x is only valid within the try/catch block. To fix, do this:
	long x = 5;
	try {
		x = x * 10;   // ok
	} catch ( Exception e ) {}
	x = x + 9;   // ok


Example:
If any error occurs with the method call, an Exception will be thrown.
	try
	{
		... do something here, such as ...

		CameraAPI.WriteFitsFile( "Image.fit", 600, 512 );
	}
	catch ( Exception e }
	{
		... do something here,
                such as log an error ...

		logger.error( e );
	}