Example #1
0
import logging
from nose.tools import set_trace
import requests
import urlparse
from flask_babel import lazy_gettext as _
from problem_detail import (
    ProblemDetail as pd,
    JSON_MEDIA_TYPE as PROBLEM_DETAIL_JSON_MEDIA_TYPE,
)

INTEGRATION_ERROR = pd(
      "http://librarysimplified.org/terms/problem/remote-integration-failed",
      502,
      _("Third-party service failed."),
      _("A third-party service has failed."),
)

class IntegrationException(Exception):
    """An exception that happens when the site's connection to a
    third-party service is broken.

    This may be because communication failed
    (RemoteIntegrationException), or because local configuration is
    missing or obviously wrong (CannotLoadConfiguration).
    """

    def __init__(self, message, debug_message=None):
        """Constructor.

        :param message: The normal message passed to any Exception
        constructor.
Example #2
0
import logging
from nose.tools import set_trace
import requests
import urlparse
from flask_babel import lazy_gettext as _
from problem_detail import (
    ProblemDetail as pd,
    JSON_MEDIA_TYPE as PROBLEM_DETAIL_JSON_MEDIA_TYPE,
)

INTEGRATION_ERROR = pd(
      "http://librarysimplified.org/terms/problem/remote-integration-failed",
      502,
      _("Third-party service failed."),
      _("A third-party service has failed."),
)

class IntegrationException(Exception):
    """An exception that happens when the site's connection to a
    third-party service is broken.

    This may be because communication failed
    (RemoteIntegrationException), or because local configuration is
    missing or obviously wrong (CannotLoadConfiguration).
    """

    def __init__(self, message, debug_message=None):
        """Constructor.

        :param message: The normal message passed to any Exception
        constructor.