* 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/>.
*/
#ifndef ERRORHANDLER_H
#define ERRORHANDLER_H
#include<kolab_export.h>
#include<QString>
#include<QList>
#include<QDebug>
namespaceKolab{
classDebugStream;
/**
* Kolab Error Handler
*
* Errors are reported during an operation, but the operation might still succeed.
* The error handler therefore contains all errors which occured during a single operation,
* and must be cleared at the start of a new operation.
*
* A user of the kolabobject classes should check ErrorHandler::error() after every operation.
*
* all non-const functions are not for the user of this class and only exist for internal usage.
*
* TODO: Hide everything which is not meant for the user from the interface.
* FIXME: Use Threadlocal storage to make this threadsafe.
*/
classKOLAB_EXPORTErrorHandler
{
public:
enumSeverity{
Debug,
Warning,//Warning, error could be corrected, object can be used without dataloss. This warning is also used if dataloss is acceptable because a feature is explicitly not supported.
Error,//Potentially corrupt object, writing the object back could result in dataloss. (Object could still be used to display the data readonly).
Critical//Critical error, produced object cannot be used and should be thrown away (writing back will result in dataloss).