2018-07-11 11:39:40 -04:00
|
|
|
from moto.core.exceptions import JsonRESTError
|
2018-07-10 13:50:47 -04:00
|
|
|
|
|
|
|
|
2018-07-11 11:39:40 -04:00
|
|
|
class GlueClientError(JsonRESTError):
|
|
|
|
code = 400
|
2018-07-10 13:50:47 -04:00
|
|
|
|
2018-07-11 11:39:40 -04:00
|
|
|
|
2018-10-02 17:25:14 +01:00
|
|
|
class AlreadyExistsException(GlueClientError):
|
|
|
|
def __init__(self, typ):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("AlreadyExistsException", "%s already exists." % (typ))
|
2018-07-26 17:05:09 -04:00
|
|
|
|
|
|
|
|
2018-10-02 17:25:14 +01:00
|
|
|
class DatabaseAlreadyExistsException(AlreadyExistsException):
|
|
|
|
def __init__(self):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("Database")
|
2018-10-02 17:25:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class TableAlreadyExistsException(AlreadyExistsException):
|
2018-07-26 17:05:09 -04:00
|
|
|
def __init__(self):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("Table")
|
2018-10-02 17:25:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class PartitionAlreadyExistsException(AlreadyExistsException):
|
|
|
|
def __init__(self):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("Partition")
|
2018-10-02 17:25:14 +01:00
|
|
|
|
|
|
|
|
2021-08-26 10:49:41 +01:00
|
|
|
class CrawlerAlreadyExistsException(AlreadyExistsException):
|
|
|
|
def __init__(self):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("Crawler")
|
2021-08-26 10:49:41 +01:00
|
|
|
|
|
|
|
|
2018-10-02 17:25:14 +01:00
|
|
|
class EntityNotFoundException(GlueClientError):
|
|
|
|
def __init__(self, msg):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("EntityNotFoundException", msg)
|
2018-10-02 17:25:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class DatabaseNotFoundException(EntityNotFoundException):
|
|
|
|
def __init__(self, db):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("Database %s not found." % db)
|
2018-10-02 17:25:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class TableNotFoundException(EntityNotFoundException):
|
|
|
|
def __init__(self, tbl):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("Table %s not found." % tbl)
|
2018-10-02 17:25:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class PartitionNotFoundException(EntityNotFoundException):
|
|
|
|
def __init__(self):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("Cannot find partition.")
|
2018-10-02 17:25:14 +01:00
|
|
|
|
|
|
|
|
2021-08-26 10:49:41 +01:00
|
|
|
class CrawlerNotFoundException(EntityNotFoundException):
|
|
|
|
def __init__(self, crawler):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("Crawler %s not found." % crawler)
|
2021-08-26 10:49:41 +01:00
|
|
|
|
|
|
|
|
2022-03-19 12:30:46 -04:00
|
|
|
class JobNotFoundException(EntityNotFoundException):
|
|
|
|
def __init__(self, job):
|
|
|
|
super().__init__("Job %s not found." % job)
|
|
|
|
|
|
|
|
|
2018-10-02 17:25:14 +01:00
|
|
|
class VersionNotFoundException(EntityNotFoundException):
|
|
|
|
def __init__(self):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("Version not found.")
|
2021-10-29 02:50:08 +05:30
|
|
|
|
|
|
|
|
|
|
|
class CrawlerRunningException(GlueClientError):
|
|
|
|
def __init__(self, msg):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("CrawlerRunningException", msg)
|
2021-10-29 02:50:08 +05:30
|
|
|
|
|
|
|
|
|
|
|
class CrawlerNotRunningException(GlueClientError):
|
|
|
|
def __init__(self, msg):
|
2022-01-14 18:51:49 -01:00
|
|
|
super().__init__("CrawlerNotRunningException", msg)
|
2022-03-22 06:19:56 -04:00
|
|
|
|
|
|
|
|
|
|
|
class ConcurrentRunsExceededException(GlueClientError):
|
|
|
|
def __init__(self, msg):
|
|
|
|
super().__init__("ConcurrentRunsExceededException", msg)
|
2022-04-14 21:37:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
class _InvalidOperationException(GlueClientError):
|
|
|
|
def __init__(self, error_type, op, msg):
|
|
|
|
super().__init__(
|
|
|
|
error_type,
|
|
|
|
"An error occurred (%s) when calling the %s operation: %s"
|
|
|
|
% (error_type, op, msg),
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class InvalidInputException(_InvalidOperationException):
|
|
|
|
def __init__(self, op, msg):
|
|
|
|
super().__init__("InvalidInputException", op, msg)
|
|
|
|
|
|
|
|
|
|
|
|
class InvalidStateException(_InvalidOperationException):
|
|
|
|
def __init__(self, op, msg):
|
|
|
|
super().__init__("InvalidStateException", op, msg)
|