# This file is part of jwmud, written by Helmut Pozimski in 2014. # # jwmud 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, version 2 of the License. # # jwmud 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 jwmud. If not, see . # -*- coding: utf8 -*- class DataBaseAccessFailed(Exception): """This exception will be raised when opening or creating the database failed. """ def __init__(self): self.__message = "Accessing the database failed!" def __str__(self): return self.__message class DataBaseWriteFailed(Exception): """This exception will be raised when a write access to the database failed. """ def __init__(self): self.__message = "Writing to the database failed, requested action " \ "aborted !" def __str__(self): return self.__message class WrongParameters(Exception): """This exception will be raised when the number of parameters or their value is wrong. """ def __init__(self): self.__message = "The wrong number or values of parameters where " \ "given to the function, the requested action failed." def __str__(self): return self.__message class CategoryNotFound(Exception): """This exception will be raised when the user tries to access a category that does not exist in the database. """ def __init__(self): self.__message = "The category could not be found in the database." def __str__(self): return self.__message class DayAlreadyInDatabase(Exception): """This exception will be raised when the user tries to add a day to the database which does already have an entry there. """ def __init__(self): self.__message = "This day already exists in the database." def __str__(self): return self.__message class ConfigurationFileMissing(Exception): """This exception will be raised when the configuration file is missing. """ def __init__(self): self.__message = "The configuration file does not exist." def __str__(self): return self.__message class ConfigurationFileAccessDenied(Exception): """This exception will be raised when the access to the configuration file is denied by it's permissions. """ def __init__(self): self.__message = "The configuration file could not be opened " \ "for reading." def __str__(self): return self.__message class PasswdOrGroupAccessFailed(Exception): """This exception will be raised when accessing either /etc/passwd or /etc/group failed. """ def __init__(self): self.__message = "Opening /etc/passwd or /etc/group failed." def __str__(self): return self.__message class DaemonAlreadyRunning(Exception): """This exception will be raised when another process is already running. """ def __init__(self): self.__message = "Another process is already running, exiting." def __str__(self): return self.__message class WritingPIDFileFailed(Exception): """This exception will be raised when creating the PID file failed.""" def __init__(self): self.__message = "The PID file could not be created, please check if " \ "/run or /var/run exist and are writable." def __str__(self): return self.__message