WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. Zuble QML Types   |  Zuble C++ Classes   |  Zuble Overview
Zuble  0.1
Zuble Framework C++/QML extension API
ZblException.cpp
Go to the documentation of this file.
1 /*
2  * Zuble - A run-time system for QML/Javascript applications
3  * Copyright (C) 2013, 2014 Bob Dinitto
4  *
5  * ZblException.cpp
6  *
7  * Created on: Nov 15, 2010
8  * Author: Bob Dinitto bob@ninzo.com
9  *
10  * Zuble is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24 */
25 
26 #include "ZblException.h"
27 #include <cstdarg>
28 #include "ZblThreadErr.h"
29 
30 namespace Zbl
31 {
32 
33 #if 0
35 : m_errorMessage( "undefined" )
36 {
37  zThreadErr.raiseError("facility")
38 }
39 #endif
40 
41 ZblException::ZblException( const char* errorMessage )
42 {
43  zThreadErr.raiseError(QString(errorMessage));
44 }
45 
46 ZblException::ZblException( const QString& errorMessage )
47 {
48  zThreadErr.raiseError(errorMessage);
49 }
50 
52  const QString& facility,
53  const QString& code,
54  const QString& errorMessage
55  )
56 {
57  zThreadErr.raiseError(facility, code, errorMessage);
58 }
59 
61  const char* facility,
62  const char* code,
63  const char* errorMessage
64  )
65 {
66  zThreadErr.raiseError(facility, code, errorMessage);
67 }
68 
69 //#if 0
71 {
72 }
73 //#endif
74 
75 void ZblException::rethrow( std::exception& e, const QString& message )
76 {
77  throw ZblException( message + ", source exception: " + e.what( ) );
78 }
79 
80 #if 0
81 void ZblException::rethrow( Glib::Exception& e, const QString& message )
82 {
83  throw ZblException( message + ", source exception: " + e.what( ) );
84 }
85 #endif
86 
87 const char * ZblException::what( ) const throw()
88 {
89  return zThreadErr.error().description().toUtf8().constData();
90 }
91 
92 const QString& ZblException::message( ) const
93 {
94  return zThreadErr.error().message();
95 }
96 
97 const QString& ZblException::facility( ) const
98 {
99  return zThreadErr.error().facility();
100 }
101 
102 const QString& ZblException::code( ) const
103 {
104  return zThreadErr.error().code();
105 }
106 
108  const QString& facility,
109  const QString& code) const
110 {
111  return !this->facility().compare(facility)
112  && !this->code().compare(code) ? true : false;
113 }
114 
115 } // Zbl
116 
117 
118 
virtual ~ZblException()
const QString & code() const
Definition: ZblError.cpp:94
const QString & message() const
bool matches(const QString &facility, const QString &code) const
const QString & facility() const
Definition: ZblError.cpp:89
const QString & facility() const
Definition: ZAndGate.cpp:6
#define zThreadErr
where does this show up?
Definition: ZblThreadErr.h:39
const QString & message() const
Definition: ZblError.cpp:99
const char * what() const
Zuble&#39;s Qt Exception Object.
Definition: ZblException.h:45
const QString & code() const
static void rethrow(std::exception &e, const QString &message)