mantelo.exceptions
==================

.. py:module:: mantelo.exceptions


Exceptions
----------

.. autoapisummary::

   mantelo.exceptions.ManteloException
   mantelo.exceptions.AuthenticationException
   mantelo.exceptions.HttpException
   mantelo.exceptions.HttpClientError
   mantelo.exceptions.HttpNotFound
   mantelo.exceptions.HttpServerError
   mantelo.exceptions.SerializerNoAvailable


Module Contents
---------------

.. py:exception:: ManteloException

   Bases: :py:obj:`Exception`


   Base exception for all exceptions raised by the Mantelo library.


.. py:exception:: AuthenticationException

   Bases: :py:obj:`ManteloException`


   Exception raised when the authentication request fails with a `401 Unauthorized` status code.


   .. py:attribute:: error
      :type:  str

      The error message from Keycloak.



   .. py:attribute:: error_description
      :type:  str

      The error description from Keycloak.



   .. py:attribute:: response
      :type:  requests.Response

      The response object from the server.



.. py:exception:: HttpException

   Bases: :py:obj:`ManteloException`


   Exception raised on HTTP errors when talking to the Keycloak Admin API.


   .. py:attribute:: status_code
      :type:  int

      The HTTP status code.



   .. py:attribute:: json
      :type:  dict

      The JSON response from the server, or an empty JSON if the body is not JSON.



   .. py:attribute:: url
      :type:  str

      The URL that was requested.



   .. py:attribute:: response
      :type:  requests.Response

      The response object from the server.



   .. py:method:: from_response(response: requests.Response) -> HttpException
      :classmethod:



.. py:exception:: HttpClientError

   Bases: :py:obj:`HttpException`


   Called when the server tells us there was a client error (4xx).


.. py:exception:: HttpNotFound

   Bases: :py:obj:`HttpClientError`


   Called when the server sends a 404 error.


.. py:exception:: HttpServerError

   Bases: :py:obj:`HttpException`


   Called when the server tells us there was a server error (5xx).


.. py:exception:: SerializerNoAvailable

   Bases: :py:obj:`ManteloException`


   The serializer for the content type is not available.


