Source code for acapi2.exceptions

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""Acquia Cloud API Exceptions"""

from pprint import pformat


[docs]class AcquiaCloudException(Exception): """Generic Acquia Cloud API Exception. All acapi2 exceptions should extend this class. """
[docs]class AcquiaCloudNoDataException(AcquiaCloudException): """No data found exception."""
[docs]class AcquiaCloudNotificationException(AcquiaCloudException): """An Acquia notification exception.""" def __init__(self, message, task): """Constructor. Parameters ---------- message: str The error message. task: Task The Task object for the task that failed. """ super().__init__(message) self.message = message self.task = task def __str__(self): """Return the string representation of the exception. Returns ------- str The error message and pretty printed Task object properties. """ task = pformat(self.task, indent=4) return f"{self.message}\n{task}"
[docs]class AcquiaCloudTaskFailedException(AcquiaCloudNotificationException): """An Acquia task failure exception."""
[docs]class AcquiaCloudNotificationFailedException(AcquiaCloudNotificationException): """An Acquia notification failure exception."""
[docs]class AcquiaCloudTimeoutError(AcquiaCloudNotificationException): """Timeout exceeded error."""