Merge pull request #450 from CartoDB/move_exceptions_to_avoid_circular_dependencies
Move exceptions to a proper place
This commit is contained in:
commit
9e67beab3d
@ -3,5 +3,7 @@ from coordinates import Coordinate
|
|||||||
from polyline import PolyLine
|
from polyline import PolyLine
|
||||||
from log import Logger, LoggerConfig
|
from log import Logger, LoggerConfig
|
||||||
from rate_limiter import RateLimiter
|
from rate_limiter import RateLimiter
|
||||||
from service_manager import ServiceManager, RateLimitExceeded, QuotaExceededException
|
from service_manager import ServiceManager
|
||||||
from legacy_service_manager import LegacyServiceManager
|
from legacy_service_manager import LegacyServiceManager
|
||||||
|
from exceptions import QuotaExceededException, RateLimitExceeded
|
||||||
|
from country import country_to_iso3
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
class TimeoutException(Exception):
|
class TimeoutException(Exception):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return repr('Timeout requesting to server')
|
return repr('Timeout requesting to server')
|
||||||
@ -29,3 +28,11 @@ class WrongParams(Exception):
|
|||||||
class MalformedResult(Exception):
|
class MalformedResult(Exception):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return repr('Result structure is malformed')
|
return repr('Result structure is malformed')
|
||||||
|
|
||||||
|
class RateLimitExceeded(Exception):
|
||||||
|
def __str__(self):
|
||||||
|
return repr('Rate limit exceeded')
|
||||||
|
|
||||||
|
class QuotaExceededException(Exception):
|
||||||
|
def __str__(self):
|
||||||
|
return repr('You have reached the limit of your quota')
|
||||||
|
@ -1,20 +1,12 @@
|
|||||||
from cartodb_services.metrics import QuotaService
|
from cartodb_services.metrics import QuotaService
|
||||||
from cartodb_services.tools import Logger
|
from cartodb_services.tools.log import Logger
|
||||||
from cartodb_services.tools import RateLimiter
|
from cartodb_services.tools.rate_limiter import RateLimiter
|
||||||
|
from cartodb_services.tools.exceptions import QuotaExceededException, RateLimitExceeded
|
||||||
from cartodb_services.refactor.tools.logger import LoggerConfigBuilder
|
from cartodb_services.refactor.tools.logger import LoggerConfigBuilder
|
||||||
from cartodb_services.refactor.backend.redis_metrics_connection import RedisMetricsConnectionFactory
|
from cartodb_services.refactor.backend.redis_metrics_connection import RedisMetricsConnectionFactory
|
||||||
from cartodb_services.config import ServiceConfiguration, RateLimitsConfigBuilder
|
from cartodb_services.config import ServiceConfiguration, RateLimitsConfigBuilder
|
||||||
|
|
||||||
|
|
||||||
class RateLimitExceeded(Exception):
|
|
||||||
def __str__(self):
|
|
||||||
return repr('Rate limit exceeded')
|
|
||||||
|
|
||||||
class QuotaExceededException(Exception):
|
|
||||||
def __str__(self):
|
|
||||||
return repr('You have reached the limit of your quota')
|
|
||||||
|
|
||||||
|
|
||||||
class ServiceManagerBase:
|
class ServiceManagerBase:
|
||||||
"""
|
"""
|
||||||
A Service manager collects the configuration needed to use a service,
|
A Service manager collects the configuration needed to use a service,
|
||||||
|
Loading…
Reference in New Issue
Block a user