Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117877282
errorhandler.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
errorhandler.cpp
View Options
/*
* Copyright (C) 2012 Christian Mollekopf <mollekopf@kolabsys.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
"errorhandler.h"
#include
<qdebug.h>
#include
<kolabformat.h>
namespace
Kolab
{
void
logMessage
(
const
QString
&
message
,
const
QString
&
file
,
int
line
,
ErrorHandler
::
Severity
s
)
{
ErrorHandler
::
instance
().
addError
(
s
,
message
,
file
+
" "
+
QString
::
number
(
line
));
}
void
ErrorHandler
::
addError
(
ErrorHandler
::
Severity
s
,
const
QString
&
message
,
const
QString
&
location
)
{
if
(
s
==
Debug
)
{
qDebug
()
<<
location
<<
": "
<<
message
;
return
;
}
else
{
qWarning
()
<<
location
<<
": "
<<
message
;
}
if
(
s
>
m_worstError
)
{
m_worstError
=
s
;
}
m_errorQueue
.
append
(
Err
(
s
,
message
,
location
));
}
ErrorHandler
::
Severity
ErrorHandler
::
error
()
const
{
return
m_worstError
;
}
const
QList
<
ErrorHandler
::
Err
>&
ErrorHandler
::
getErrors
()
const
{
return
m_errorQueue
;
}
void
ErrorHandler
::
clear
()
{
m_errorQueue
.
clear
();
m_worstError
=
Debug
;
}
void
ErrorHandler
::
handleLibkolabxmlErrors
()
{
switch
(
Kolab
::
error
())
{
case
Kolab
::
Warning
:
instance
().
addError
(
ErrorHandler
::
Warning
,
QString
::
fromStdString
(
Kolab
::
errorMessage
()),
"libkolabxml"
);
break
;
case
Kolab
::
Error
:
instance
().
addError
(
ErrorHandler
::
Error
,
QString
::
fromStdString
(
Kolab
::
errorMessage
()),
"libkolabxml"
);
break
;
case
Kolab
::
Critical
:
instance
().
addError
(
ErrorHandler
::
Critical
,
QString
::
fromStdString
(
Kolab
::
errorMessage
()),
"libkolabxml"
);
break
;
default
:
//Do nothing, there is no message available in this case
break
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sun, Apr 5, 9:27 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18750231
Default Alt Text
errorhandler.cpp (2 KB)
Attached To
Mode
rLK libkolab
Attached
Detach File
Event Timeline