<commit_before>Exception Handling
==================

When calling a remote procedure an ``Exception`` might be raised by the remote application. It this happens the *Callee's* ``Exception`` will be wrapped in a wampy ``RemoteException`` and will contain the name of the remote procedure that raised the error, the ``request_id``, the exception type and any message.<commit_msg>add Exception handling example<commit_after>Exception Handling
==================

When calling a remote procedure an ``Exception`` might be raised by the remote application. It this happens the *Callee's* ``Exception`` will be wrapped in a wampy ``RemoteError`` and will contain the name of the remote procedure that raised the error, the ``request_id``, the exception type and any message.

::

    from wampy.errors import RemoteError
    from wampy.peers.clients import Client


    try:
        with Client() as client:
            response = client.rpc.some_unreliable_procedure()
    except RemoteError as rmt_err:
        # do stuff here to recover from the error
{'fraction_non_alphanumeric': 0.09914204003813155, 'fraction_numerical': 0.0, 'mean_word_length': 4.4404145077720205, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4303295', 'n_tokens_mistral': 260, 'n_tokens_neox': 247, 'n_words': 129}