Loading...
Searching...
No Matches
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::Exception
Exception(std::string const &name, std::string const &reason)
Constructs an exception instance.
Definition Exception.cpp:165
lomiri::Exception::reason
std::string reason() const
Returns the reason set by the derived class's constructor (empty string if none).
Definition Exception.cpp:224
lomiri::FileException::self
virtual std::exception_ptr self() const override
Returns a std::exception_ptr to this.
Definition LomiriExceptions.cpp:109
lomiri::FileException::error
int error() const noexcept
Definition LomiriExceptions.cpp:104
lomiri::FileException::FileException
FileException(std::string const &reason, int err)
Constructs the exception.
Definition LomiriExceptions.cpp:87
lomiri::InvalidArgumentException::self
virtual std::exception_ptr self() const override
Returns a std::exception_ptr to this.
Definition LomiriExceptions.cpp:42
lomiri::InvalidArgumentException::InvalidArgumentException
InvalidArgumentException(std::string const &reason)
Constructs the exception.
Definition LomiriExceptions.cpp:26
lomiri::LogicException::self
virtual std::exception_ptr self() const override
Returns a std::exception_ptr to this.
Definition LomiriExceptions.cpp:62
lomiri::LogicException::LogicException
LogicException(std::string const &reason)
Constructs the exception.
Definition LomiriExceptions.cpp:47
lomiri::ResourceException::self
virtual std::exception_ptr self() const override
Returns a std::exception_ptr to this.
Definition LomiriExceptions.cpp:155
lomiri::ResourceException::ResourceException
ResourceException(std::string const &reason)
Constructs the exception.
Definition LomiriExceptions.cpp:140
lomiri::ShutdownException::self
virtual std::exception_ptr self() const override
Returns a std::exception_ptr to this.
Definition LomiriExceptions.cpp:82
lomiri::ShutdownException::ShutdownException
ShutdownException(std::string const &reason)
Constructs the exception.
Definition LomiriExceptions.cpp:67
lomiri::SyscallException::SyscallException
SyscallException(std::string const &reason, int err)
Constructs the exception.
Definition LomiriExceptions.cpp:114
lomiri::SyscallException::self
virtual std::exception_ptr self() const override
Returns a std::exception_ptr to this.
Definition LomiriExceptions.cpp:135
lomiri::SyscallException::error
int error() const noexcept
Definition LomiriExceptions.cpp:130
lomiri
Top-level namespace for all things Lomiri-related.
Definition Version.h:38