libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
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 <QString>
35#include <QDebug>
36#include <QException>
37
38namespace pappso
39{
40class PappsoException : public QException
41{
42 public:
43 explicit PappsoException(const QString &message) throw()
44 : m_message(QString("%1@%2: %3").arg(__FILE__, __FUNCTION__, message)),
45 m_stdMessage(m_message.toStdString())
46 {
47 }
48
49 PappsoException(const PappsoException &other) throw()
50 : m_message(other.m_message), m_stdMessage(other.m_stdMessage)
51 {
52 }
53
54 void
55 raise() const override
56 {
57 throw *this;
58 }
59 virtual QException *
60 clone() const override
61 {
62 return new PappsoException(*this);
63 }
64
65 virtual const QString &
66 qwhat() const throw()
67 {
68 return m_message;
69 }
70
71 const char *
72 what() const noexcept override
73 {
74 return m_stdMessage.c_str();
75 }
76
77 virtual ~PappsoException() throw()
78 {
79 }
80
81 private:
82 QString m_message; // Description of the error
83 std::string m_stdMessage;
84};
85} // namespace pappso
PappsoException(const PappsoException &other)
PappsoException(const QString &message)
virtual QException * clone() const override
const char * what() const noexcept override
virtual const QString & qwhat() const
void raise() const override
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39