Program Listing for File exceptions.hpp
↰ Return to documentation for file (include/tf2/exceptions.hpp
)
// Copyright 2008, Willow Garage, Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the Willow Garage nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#ifndef TF2__EXCEPTIONS_HPP_
#define TF2__EXCEPTIONS_HPP_
#include <stdexcept>
#include <cstdint>
#include <string>
#include "tf2/visibility_control.h"
namespace tf2
{
enum class TF2Error : std::uint8_t
{
// While the TF2_ prefix here is a bit redundant, it also prevents us from
// colliding with Windows defines (specifically, NO_ERROR).
TF2_NO_ERROR = 0,
TF2_LOOKUP_ERROR = 1,
TF2_CONNECTIVITY_ERROR = 2,
TF2_EXTRAPOLATION_ERROR = 3,
TF2_INVALID_ARGUMENT_ERROR = 4,
TF2_TIMEOUT_ERROR = 5,
TF2_TRANSFORM_ERROR = 6,
TF2_BACKWARD_EXTRAPOLATION_ERROR = 7,
TF2_FORWARD_EXTRAPOLATION_ERROR = 8,
TF2_NO_DATA_FOR_EXTRAPOLATION_ERROR = 9,
};
class TransformException : public std::runtime_error
{
public:
TF2_PUBLIC
explicit TransformException(const std::string errorDescription)
: std::runtime_error(errorDescription)
{
}
};
class ConnectivityException : public TransformException
{
public:
TF2_PUBLIC
explicit ConnectivityException(const std::string errorDescription)
: tf2::TransformException(errorDescription)
{
}
};
class LookupException : public TransformException
{
public:
TF2_PUBLIC
explicit LookupException(const std::string errorDescription)
: tf2::TransformException(errorDescription)
{
}
};
class ExtrapolationException : public TransformException
{
public:
TF2_PUBLIC
explicit ExtrapolationException(const std::string errorDescription)
: tf2::TransformException(errorDescription)
{
}
};
class BackwardExtrapolationException : public ExtrapolationException
{
public:
TF2_PUBLIC
explicit BackwardExtrapolationException(const std::string errorDescription)
: ExtrapolationException(errorDescription)
{
}
};
class ForwardExtrapolationException : public ExtrapolationException
{
public:
TF2_PUBLIC
explicit ForwardExtrapolationException(const std::string errorDescription)
: ExtrapolationException(errorDescription)
{
}
};
class NoDataForExtrapolationException : public ExtrapolationException
{
public:
TF2_PUBLIC
explicit NoDataForExtrapolationException(const std::string errorDescription)
: ExtrapolationException(errorDescription)
{
}
};
class InvalidArgumentException : public TransformException
{
public:
TF2_PUBLIC
explicit InvalidArgumentException(const std::string errorDescription)
: tf2::TransformException(errorDescription) {}
};
class TimeoutException : public TransformException
{
public:
TF2_PUBLIC
explicit TimeoutException(const std::string errorDescription)
: tf2::TransformException(errorDescription)
{
}
};
} // namespace tf2
#endif // TF2__EXCEPTIONS_HPP_