/usr/include/unity/UnityExceptions.h is in libunity-api-dev 8.7+17.04.20170404-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | /*
* 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
{
/**
\brief Exception to indicate that an invalid argument was passed to a function, such as passing <code>nullptr</code>
when the function expects the argument to be non-null.
*/
class UNITY_API InvalidArgumentException : public Exception
{
public:
/**
\brief Constructs the exception.
\param reason Further details about the cause of the exception.
*/
explicit InvalidArgumentException(std::string const& reason);
//! @cond
InvalidArgumentException(InvalidArgumentException const&);
InvalidArgumentException& operator=(InvalidArgumentException const&);
virtual ~InvalidArgumentException() noexcept;
//! @endcond
/**
\brief Returns a <code>std::exception_ptr</code> to <code>this</code>.
*/
virtual std::exception_ptr self() const override;
};
/**
\brief Exception to indicate a logic error, such as driving the API incorrectly, such as calling methods
in the wrong worder.
*/
class UNITY_API LogicException : public Exception
{
public:
/**
\brief Constructs the exception.
\param reason Further details about the cause of the exception.
*/
explicit LogicException(std::string const& reason);
//! @cond
LogicException(LogicException const&);
LogicException& operator=(LogicException const&);
virtual ~LogicException() noexcept;
//! @endcond
/**
\brief Returns a <code>std::exception_ptr</code> to <code>this</code>.
*/
virtual std::exception_ptr self() const override;
};
/**
\brief Exception to indicate errors during shutdown.
Usually, it is not possible to handle or recover
from errors that arise during shutdown. This exception is thrown once all possible shutdown actions
have been carried out and provides information about anything that went wrong via the exception
chaining mechanism of the unity::Exception base class.
*/
class UNITY_API ShutdownException : public Exception
{
public:
/**
\brief Constructs the exception.
\param reason Further details about the cause of the exception.
*/
explicit ShutdownException(std::string const& reason);
//! @cond
ShutdownException(ShutdownException const&);
ShutdownException& operator=(ShutdownException const&);
virtual ~ShutdownException() noexcept;
//! @endcond
/**
\brief Returns a <code>std::exception_ptr</code> to <code>this</code>.
*/
virtual std::exception_ptr self() const override;
};
/**
\brief Exception to indicate file I/O errors, such as failure to open or write to a file.
*/
class UNITY_API FileException : public Exception
{
public:
/**
\brief Constructs the exception.
*/
/**
\brief Constructs the exception from a reason string and and error number.
\param reason Further details about the cause of the exception.
\param err The UNIX <code>errno</code> value for the error.
*/
FileException(std::string const& reason, int err);
//! @cond
FileException(FileException const&);
FileException& operator=(FileException const&);
virtual ~FileException() noexcept;
//! @endcond
/**
\brief Returns a <code>std::exception_ptr</code> to <code>this</code>.
*/
virtual std::exception_ptr self() const override;
/**
\return Returns the error number that was passed to the constructor.
*/
int error() const noexcept;
private:
int err_;
};
/**
\brief Exception to indicate system or library call errors that set <code>errno</code>.
*/
class UNITY_API SyscallException : public Exception
{
public:
/**
\brief Constructs the exception.
*/
/**
\brief Constructs the exception from a reason string and and error number.
\param reason Further details about the cause of the exception.
\param err The UNIX <code>errno</code> value for the error.
*/
SyscallException(std::string const& reason, int err);
//! @cond
SyscallException(SyscallException const&);
SyscallException& operator=(SyscallException const&);
virtual ~SyscallException() noexcept;
//! @endcond
/**
\brief Returns a <code>std::exception_ptr</code> to <code>this</code>.
*/
virtual std::exception_ptr self() const override;
/**
\return Returns the error number that was passed to the constructor.
*/
int error() const noexcept;
private:
int err_;
};
/**
\brief Exception for miscellaneous errors, such as failure of a third-party library or hitting resource limitations.
*/
class UNITY_API ResourceException : public Exception
{
public:
/**
\brief Constructs the exception.
\param reason Further details about the cause of the exception.
*/
explicit ResourceException(std::string const& reason);
//! @cond
ResourceException(ResourceException const&);
ResourceException& operator=(ResourceException const&);
virtual ~ResourceException() noexcept;
//! @endcond
/**
\brief Returns a <code>std::exception_ptr</code> to <code>this</code>.
*/
virtual std::exception_ptr self() const override;
};
} // namespace unity
#endif
|