LomiriExceptions.h
/*
* Copyright (C) 2013 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as
* published by the Free Software Foundation.
*
* 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/>.
*
* Authored by: Michi Henning <michi.henning@canonical.com>
*/
#ifndef LOMIRI_EXCEPTIONS_H
#define LOMIRI_EXCEPTIONS_H
#include <lomiri/Exception.h>
namespace lomiri
{
class LOMIRI_API InvalidArgumentException : public Exception
{
public:
explicit InvalidArgumentException(std::string const& reason);
InvalidArgumentException(InvalidArgumentException const&);
InvalidArgumentException& operator=(InvalidArgumentException const&);
virtual ~InvalidArgumentException() noexcept;
virtual std::exception_ptr self() const override;
};
class LOMIRI_API LogicException : public Exception
{
public:
explicit LogicException(std::string const& reason);
LogicException(LogicException const&);
LogicException& operator=(LogicException const&);
virtual ~LogicException() noexcept;
virtual std::exception_ptr self() const override;
};
class LOMIRI_API ShutdownException : public Exception
{
public:
explicit ShutdownException(std::string const& reason);
ShutdownException(ShutdownException const&);
ShutdownException& operator=(ShutdownException const&);
virtual ~ShutdownException() noexcept;
virtual std::exception_ptr self() const override;
};
class LOMIRI_API FileException : public Exception
{
public:
FileException(std::string const& reason, int err);
FileException(FileException const&);
FileException& operator=(FileException const&);
virtual ~FileException() noexcept;
virtual std::exception_ptr self() const override;
int error() const noexcept;
private:
int err_;
};
class LOMIRI_API SyscallException : public Exception
{
public:
SyscallException(std::string const& reason, int err);
SyscallException(SyscallException const&);
SyscallException& operator=(SyscallException const&);
virtual ~SyscallException() noexcept;
virtual std::exception_ptr self() const override;
int error() const noexcept;
private:
int err_;
};
class LOMIRI_API ResourceException : public Exception
{
public:
explicit ResourceException(std::string const& reason);
ResourceException(ResourceException const&);
ResourceException& operator=(ResourceException const&);
virtual ~ResourceException() noexcept;
virtual std::exception_ptr self() const override;
};
} // namespace lomiri
#endif
lomiri::Exception
Abstract base class for all Lomiri exceptions.
Definition: Exception.h:104
lomiri::FileException
Exception to indicate file I/O errors, such as failure to open or write to a file.
Definition: LomiriExceptions.h:112
lomiri::InvalidArgumentException
Exception to indicate that an invalid argument was passed to a function, such as passing nullptr when...
Definition: LomiriExceptions.h:33
lomiri::LogicException
Exception to indicate a logic error, such as driving the API incorrectly, such as calling methods in ...
Definition: LomiriExceptions.h:58
lomiri::ResourceException
Exception for miscellaneous errors, such as failure of a third-party library or hitting resource limi...
Definition: LomiriExceptions.h:184
lomiri::ShutdownException
Exception to indicate errors during shutdown.
Definition: LomiriExceptions.h:87
lomiri::SyscallException
Exception to indicate system or library call errors that set errno.
Definition: LomiriExceptions.h:148
lomiri
Top-level namespace for all things Lomiri-related.
Definition: Version.h:38