-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Labels
Description
This needs to ensure that the full error message from the API is returned,
Otherwise it is very difficult to debug 400 errors.
class ErrAtlasBadRequest(ErrAtlasGeneric):
"""Atlas : Bad Request
Constructor
Args:
c (int): HTTP code
details (dict): Response payload
"""
def __init__(self, c, details):
if details.get('errorCode', None) == 'DUPLICATE_CLUSTER_NAME':
raise (ErrAtlasDuplicateClusterName(c, details))
if details.get('errorCode', None) == 'RESOURCE_NOT_FOUND_FOR_JOB':
raise (ErrAtlasJobError(c, details))
if details.get('errorCode', None) == 'CANNOT_CANCEL_AUTOMATED_RESTORE':
raise (ErrAtlasBackupError(c,details))
if details.get('errorCode', None) in ['ATLAS_MAINTENANCE_ALREADY_SCHEDULED',
'ATLAS_NUM_MAINTENANCE_DEFERRALS_EXCEEDED']:
raise (ErrMaintenanceError(c,details))
else:
logger.critical(f"A generic error was raised")
logger.critical(details)
super().__init__("Something was wrong with the client request.", c, details)