/usr/include/sdformat-6.0/sdf/Exception.hh is in libsdformat6-dev 6.0.0+dfsg-4.
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 | /*
* Copyright 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef _SDF_EXCEPTION_HH_
#define _SDF_EXCEPTION_HH_
#include <cstdint>
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
#include "sdf/system_util.hh"
#ifdef _WIN32
// Disable warning C4251 which is triggered by
// std::unique_ptr
#pragma warning(push)
#pragma warning(disable: 4251)
#endif
namespace sdf
{
/// \addtogroup sdf
/// \{
/// \brief This macro logs an error to the throw stream and throws
/// an exception that contains the file name and line number.
#define sdfthrow(msg) {std::ostringstream throwStream;\
throwStream << msg << std::endl << std::flush;\
throw sdf::Exception(__FILE__, __LINE__, throwStream.str()); }
class ExceptionPrivate;
/// \class Exception Exception.hh common/common.hh
/// \brief Class for generating exceptions
class SDFORMAT_VISIBLE Exception
{
/// \brief Constructor
public: Exception();
/// \brief Default constructor
/// \param[in] _file File name
/// \param[in] _line Line number where the error occurred
/// \param[in] _msg Error message
public: Exception(const char *_file,
std::int64_t _line,
std::string _msg);
/// \brief Copy constructor
/// \param[in] _e Exception to copy.
public: Exception(const Exception &_e);
/// \brief Destructor
public: virtual ~Exception();
/// \brief Return the error function
/// \return The error function name
public: std::string GetErrorFile() const;
/// \brief Return the error string
/// \return The error string
public: std::string GetErrorStr() const;
/// \brief Print the exception to std out.
public: void Print() const;
/// \brief stream insertion operator for Gazebo Error
/// \param[in] _out the output stream
/// \param[in] _err the exception
public: friend std::ostream &operator<<(std::ostream& _out,
const sdf::Exception &_err)
{
return _out << _err.GetErrorStr();
}
/// \brief Private data pointer.
private: std::unique_ptr<ExceptionPrivate> dataPtr;
};
/// \class InternalError Exception.hh common/common.hh
/// \brief Class for generating Internal Gazebo Errors:
/// those errors which should never happend and
/// represent programming bugs.
class SDFORMAT_VISIBLE InternalError : public Exception
{
/// \brief Constructor
public: InternalError();
/// \brief Default constructor
/// \param[in] _file File name
/// \param[in] _line Line number where the error occurred
/// \param[in] _msg Error message
public: InternalError(const char *_file, std::int64_t _line,
const std::string _msg);
/// \brief Destructor
public: virtual ~InternalError();
};
/// \class AssertionInternalError Exception.hh common/common.hh
/// \brief Class for generating Exceptions which come from
/// sdf assertions. They include information about the
/// assertion expression violated, function where problem
/// appeared and assertion debug message.
class SDFORMAT_VISIBLE AssertionInternalError : public InternalError
{
/// \brief Constructor for assertions
/// \param[in] _file File name
/// \param[in] _line Line number where the error occurred
/// \param[in] _expr Assertion expression failed resulting in an
/// internal error
/// \param[in] _function Function where assertion failed
/// \param[in] _msg Function where assertion failed
public: AssertionInternalError(const char *_file,
std::int64_t _line,
const std::string _expr,
const std::string _function,
const std::string _msg = "");
/// \brief Destructor
public: virtual ~AssertionInternalError();
};
/// \}
}
#ifdef _WIN32
#pragma warning(pop)
#endif
#endif
|