Source code for ocd.errors

# Observing condition decision tool: monitor conditions and plan HETDEX
# observations
# Copyright (C) 2017, 2018  "The HETDEX collaboration"
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
'''OCD exceptions'''

import peewee


# # Warnings # #

[docs]class OCDWarning(Warning): '''Base OCD warning''' pass
[docs]class OCDSeriousWarning(OCDWarning): '''OCD warning that needs some pondering''' pass
[docs]class OCDZMQWarning(OCDWarning): '''OCD warning used when initializing ZMQ servers and one url in empty''' pass
# # Exceptions # #
[docs]class OCDException(Exception): '''Base OCD error''' pass
[docs]class OCDValueError(OCDException, ValueError): '''Value error within OCD''' pass
[docs]class OCDTypeError(OCDException, TypeError): '''Type error within OCD''' pass
[docs]class OCDIndexError(OCDException, IndexError): '''Index error within OCD''' pass
[docs]class ShuffleConfigError(OCDException, ValueError): '''Some of the shuffle configuration values do not agree with what OCD expects''' pass
[docs]class ShotDoesNotExist(OCDException, peewee.DoesNotExist): '''Error raised by OCD when some query on :class:`ocd.shots_db.Shots` fail''' pass
[docs]class ShotIntegrityError(OCDException, peewee.IntegrityError): '''reraise peewee IntegrityError''' pass
[docs]class ShotColumnError(OCDException, KeyError): '''Reraise KeyError if a column is missing in the shot file''' pass
[docs]class AutoscheduleError(OCDException): '''Raised when autoschedule fails for some motivation''' pass
[docs]class ObsnumIntegrityError(OCDException): '''Raised when the observation number is larger than it should''' pass
[docs]class TimeOutError(OCDException): '''Exception raised when a timeout is hit, e.g. in :func:`timeout_context`.''' pass