Move exceptions to a proper place

This commit is contained in:
Mario de Frutos 2018-02-02 12:06:33 +01:00
parent 14925ea448
commit 6e54507b5a
3 changed files with 11 additions and 11 deletions

View File

@ -3,5 +3,6 @@ from coordinates import Coordinate
from polyline import PolyLine
from log import Logger, LoggerConfig
from rate_limiter import RateLimiter
from service_manager import ServiceManager, RateLimitExceeded, QuotaExceededException
from service_manager import ServiceManager, RateLimitExceeded
from legacy_service_manager import LegacyServiceManager
from exceptions import QuotaExceededException, RateLimitExceeded

View File

@ -1,6 +1,5 @@
import json
class TimeoutException(Exception):
def __str__(self):
return repr('Timeout requesting to server')
@ -29,3 +28,11 @@ class WrongParams(Exception):
class MalformedResult(Exception):
def __str__(self):
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')

View File

@ -1,20 +1,12 @@
from cartodb_services.metrics import QuotaService
from cartodb_services.tools import Logger
from cartodb_services.tools import RateLimiter
from cartodb_services.tools import QuotaExceededException, RateLimitExceeded
from cartodb_services.refactor.tools.logger import LoggerConfigBuilder
from cartodb_services.refactor.backend.redis_metrics_connection import RedisMetricsConnectionFactory
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:
"""
A Service manager collects the configuration needed to use a service,