FAAST  0.2.1
Exceptions.hpp
1 /*
2  This file is part of the FAAST library.
3 
4  Copyright (c) 2009 Luca De Feo and Éric Schost.
5 
6  The most recent version of FAAST is available at http://www.lix.polytechnique.fr/~defeo/FAAST
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License
10  as published by the Free Software Foundation; either version 2
11  of the License, or (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; see file COPYING. If not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22 #ifndef EXCEPTIONS_H_
23 #define EXCEPTIONS_H_
24 
25 #include <exception>
26 
27 namespace FAAST {
37  class FAASTException : public std::exception {
38  private:
39  const char* message;
40  public:
41  FAASTException() {}
42  FAASTException(const char* m) : message(m) {}
43  virtual const char* what() const throw() {
44  return message;
45  }
46  };
47 
52  public:
53  NotIrreducibleException() : FAASTException("NotIrreducibleException") {}
54  };
58  class IsIrreducibleException : public FAASTException { public:
59  IsIrreducibleException() : FAASTException("IsIrreducibleException") {}
60  };
64  class NotPrimeException : public FAASTException { public:
65  NotPrimeException() : FAASTException("NotPrimeException") {}
66  };
70  class NoOverFieldException : public FAASTException { public:
71  NoOverFieldException() : FAASTException("NoOverFieldException") {}
72  };
76  class NoSubFieldException : public FAASTException { public:
77  NoSubFieldException() : FAASTException("NoSubFieldException") {}
78  };
82  class NotASubFieldException : public FAASTException { public:
83  NotASubFieldException() : FAASTException("NotASubFieldException") {}
84  };
88  class NotInSameFieldException : public FAASTException { public:
89  NotInSameFieldException() : FAASTException("NotInSameFieldException") {}
90  };
95  public:
96  DivisionByZeroException() : FAASTException("DivisionByZeroException") {}
97  };
101  class IllegalCoercionException : public FAASTException { public:
102  IllegalCoercionException() : FAASTException("IllegalCoercionException") {}
103  };
107  class NoSuchPolynomialException : public FAASTException { public:
108  NoSuchPolynomialException() : FAASTException("NoSuchPolynomialException") {}
109  };
114  public:
115  NotSupportedException() : FAASTException("NotSupportedException") {}
116  NotSupportedException(const char* m) : FAASTException(m) {}
117  };
152  public:
153  UndefinedFieldException() : FAASTException("This is the 0 element of any field.") {}
154  };
159  public:
160  BadParametersException() : FAASTException("BadParametersException") {}
161  BadParametersException(const char* m) : FAASTException(m) {}
162  };
167  public:
168  CharacteristicTooLargeException() : FAASTException("Do you really think it is wise to do computational\n Artin-Schreier theory in characteristic\n >= 2^(your machine word length) ?!") {}
169  };
170 
174 }
175 
176 
177 #endif /*EXCEPTIONS_H_*/