1# Licensed under a 3-clause BSD style license - see LICENSE.rst 2""" 3This module contains errors/exceptions and warnings of general use for 4astropy. Exceptions that are specific to a given subpackage should *not* be 5here, but rather in the particular subpackage. 6""" 7 8# TODO: deprecate these. This cannot be trivially done with 9# astropy.utils.decorators.deprecate, since that module needs the exceptions 10# here, leading to circular import problems. 11from erfa import ErfaError, ErfaWarning # noqa 12 13 14__all__ = [ 15 'AstropyWarning', 16 'AstropyUserWarning', 17 'AstropyDeprecationWarning', 18 'AstropyPendingDeprecationWarning', 19 'AstropyBackwardsIncompatibleChangeWarning', 20 'DuplicateRepresentationWarning', 21 'NoValue'] 22 23 24class AstropyWarning(Warning): 25 """ 26 The base warning class from which all Astropy warnings should inherit. 27 28 Any warning inheriting from this class is handled by the Astropy logger. 29 """ 30 31 32class AstropyUserWarning(UserWarning, AstropyWarning): 33 """ 34 The primary warning class for Astropy. 35 36 Use this if you do not need a specific sub-class. 37 """ 38 39 40class AstropyDeprecationWarning(AstropyWarning): 41 """ 42 A warning class to indicate a deprecated feature. 43 """ 44 45 46class AstropyPendingDeprecationWarning(PendingDeprecationWarning, AstropyWarning): 47 """ 48 A warning class to indicate a soon-to-be deprecated feature. 49 """ 50 51 52class AstropyBackwardsIncompatibleChangeWarning(AstropyWarning): 53 """ 54 A warning class indicating a change in astropy that is incompatible 55 with previous versions. 56 57 The suggested procedure is to issue this warning for the version in 58 which the change occurs, and remove it for all following versions. 59 """ 60 61 62class DuplicateRepresentationWarning(AstropyWarning): 63 """ 64 A warning class indicating a representation name was already registered 65 """ 66 67 68class _NoValue: 69 """Special keyword value. 70 71 This class may be used as the default value assigned to a 72 deprecated keyword in order to check if it has been given a user 73 defined value. 74 """ 75 def __repr__(self): 76 return 'astropy.utils.exceptions.NoValue' 77 78 79NoValue = _NoValue() 80