# `except E as e` binds the occurrence without an import of ada.exceptions; Python's str of
# it, in print, str() and f-strings, is its message
class Rejected(Exception):
    pass


def check(n: int) -> None:
    try:
        if n > 2:
            raise Rejected("too large")
        print("accepted", n)
    except Rejected as e:
        print("rejected:", e)
        print(f"({str(e)})")


def main() -> None:
    check(1)
    check(5)


if __name__ == "__main__":
    main()
