'''
exceptions.py: exceptions defined by CommonPy

Authors
-------

Michael Hucka <mhucka@caltech.edu> -- Caltech Library

Copyright
---------

Copyright (c) 2020-2023 by the California Institute of Technology.  This code
is open-source software released under a 3-clause BSD license.  Please see the
file "LICENSE" for more information.
'''


# Base class.
# .............................................................................
# The base class makes it possible to use a single test to distinguish
# between exceptions generated by CommonPy code and exceptions generated by
# something else.

class CommonPyException(Exception):
    '''Base class for CommonPy exceptions.'''


# Exception classes.
# .............................................................................

class Interrupted(CommonPyException):
    '''The user elected to cancel/quit the program.'''


class NetworkFailure(CommonPyException):
    '''Unrecoverable problem involving network operations.'''


class ServiceFailure(CommonPyException):
    '''Unrecoverable problem involving a remote service.'''


class AuthenticationFailure(CommonPyException):
    '''Problem obtaining or using authentication credentials.'''


class NoContent(CommonPyException):
    '''No content found at the given location.'''


class RateLimitExceeded(CommonPyException):
    '''The service flagged reports that its rate limits have been exceeded.'''


class ArgumentError(CommonPyException):
    '''Incorrect or invalid argument or argument value.'''


class InternalError(CommonPyException):
    '''Unrecoverable problem involving commonpy itself.'''
