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