@cc_on
@set @works=0

import System;

class generalException { }
class specializedException extends generalException { }
class moreSpecializedException extends specializedException { }

function test() {
  try {
   Console.WriteLine("throw moreSpecializedException...");
   throw new moreSpecializedException();
  }
@if (0==@works)
  catch (e:generalException) { 
    Console.WriteLine("Przechwycono generalException");
  }
  catch (e:specializedException) { 
    Console.WriteLine("Przechwycono specializedException");
  }
   catch (e:moreSpecializedException) {  
    Console.WriteLine("Przechwycono moreSpecializedException");
  }

@else  
   catch (e:moreSpecializedException) {  
    Console.WriteLine("Przechwycono moreSpecializedException");
  }
   catch (e:specializedException) {  
    Console.WriteLine("Przechwycono specializedException");
  }
  catch (e:generalException) { 
    Console.WriteLine("Przechwycono generalException");
  }
@end
  finally {
    Console.WriteLine("Wykonywanie bloku finally");
  }
  Console.WriteLine("Wyjście");
}

test();
