Name: ExceptionHandling

Methods:
  testThrow:
    Arguments:
      - enum:
          Contract: $.int().notNull()
    Body:
      Try:
        - trace('enter try')
        - $.doThrow($enum)
        - trace('exit try')
      Catch:
        - With: exceptionName
          As: e
          Do:
            - trace($e.message)
        - With: anotherExceptionName
          As: e
          Do:
            - trace($e.message)
            - trace(rethrow)
            - Rethrow:
        - As: e
          Do:
            - trace('catch all')
            - trace($e.message)
      Else:
        - trace('else section')
      Finally:
        - trace('finally section')

  doThrow:
    Arguments:
      - enum:
          Contract: $.int().notNull()
    Body:
      - Match:
          1:
            - Throw: exceptionName
              Message: exception message
          2:
            - Throw: anotherExceptionName
              Message: exception message 2
          3:
            - Throw: thirdExceptionName
              Message: exception message 3
          4:
            - Return:
        Value: $enum

  testStackTrace:
    Body:
      raisePythonException()

