libpappsomspp
Library for mass spectrometry
pappsoexception.h
Go to the documentation of this file.
1 /**
2  * \file pappsomspp/pappsoexception.cpp
3  * \date 10/3/2015
4  * \author Olivier Langella
5  * \brief exception handler
6  */
7 
8 /*******************************************************************************
9  * Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
10  *
11  * This file is part of the PAPPSOms++ library.
12  *
13  * PAPPSOms++ is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation, either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * PAPPSOms++ is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
25  *
26  * Contributors:
27  * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
28  *implementation
29  ******************************************************************************/
30 
31 
32 #pragma once
33 
34 #include <exception>
35 #include <QString>
36 #include <QDebug>
37 #include <QException>
38 
39 namespace pappso
40 {
41 class PappsoException : public QException
42 {
43  public:
44  PappsoException(const QString &message) throw()
45  {
46  qDebug() << message;
47  m_message = message;
48  m_stdMessage.assign(m_message.toStdString());
49  }
50 
51  PappsoException(const PappsoException &other) throw()
52  {
53  m_message = other.m_message;
54  m_stdMessage.assign(m_message.toStdString());
55  }
56  void
57  raise() const override
58  {
59  throw *this;
60  }
61  virtual QException *
62  clone() const override
63  {
64  return new PappsoException(*this);
65  }
66 
67  virtual const QString &
68  qwhat() const throw()
69  {
70  return m_message;
71  }
72 
73  const char *
74  what() const noexcept override
75  {
76  return m_stdMessage.c_str();
77  }
78 
79  virtual ~PappsoException() throw()
80  {
81  }
82 
83  private:
84  std::string m_stdMessage;
85  QString m_message; // Description of the error
86 };
87 } // namespace pappso
PappsoException(const PappsoException &other)
PappsoException(const QString &message)
virtual const QString & qwhat() const
virtual QException * clone() const override
const char * what() const noexcept override
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39