Go to the documentation of this file.
23 #include <ignition/utils/ImplPtr.hh>
24 #include <sdf/sdf_config.h>
31 #pragma warning(disable: 4251)
37 inline namespace SDF_VERSION_NAMESPACE {
157 public:
Error(
const ErrorCode _code,
const std::string &_message);
165 const std::string &_filePath);
175 const std::string &_filePath,
int _lineNumber);
184 public: std::string Message()
const;
189 public: std::optional<std::string> FilePath()
const;
193 public: std::optional<int> LineNumber()
const;
198 public: std::optional<std::string> XmlPath()
const;
204 public:
void SetXmlPath(
const std::string &_xmlPath);
209 public:
explicit operator bool()
const;
218 public:
bool operator==(
const bool _value)
const;
227 std::string pathInfo =
"";
229 if (_err.
XmlPath().has_value())
230 pathInfo += _err.
XmlPath().value();
233 pathInfo +=
":" + _err.
FilePath().value();
236 pathInfo +=
":L" + std::to_string(_err.
LineNumber().value());
238 if (!pathInfo.empty())
239 pathInfo =
"[" + pathInfo +
"]: ";
241 _out <<
"Error Code "
242 <<
static_cast<std::underlying_type<sdf::ErrorCode>::type
>(
250 IGN_UTILS_IMPL_PTR(dataPtr)
@ JOINT_PARENT_LINK_INVALID
A joint has an invalid parent link.
@ JOINT_CHILD_LINK_INVALID
A joint has an invalid child link.
@ URI_LOOKUP
A error occured while trying to resolve a URI.
std::optional< std::string > XmlPath() const
Get the XPath-like trace that is associated with this error.
@ MODEL_WITHOUT_LINK
A model without a link.
namespace for Simulation Description Format parser
Definition: Actor.hh:33
ErrorCode Code() const
Get the error code.
friend std::ostream & operator<<(std::ostream &_out, const sdf::Error &_err)
Output operator for an error.
Definition: Error.hh:224
@ DUPLICATE_NAME
A duplicate name was found for an element where unique names are required.
@ ELEMENT_INVALID
This error indicates that an SDF element is invalid.
std::string Message() const
Get the error message, which is a description of the error.
@ DIRECTORY_NONEXISTANT
A filesystem directory does not exist.
@ POSE_RELATIVE_TO_CYCLE
The pose relative-to graph contains a cycle.
@ FRAME_ATTACHED_TO_CYCLE
The frame attached-to graph contains a cycle.
#define SDFORMAT_VISIBLE
Definition: system_util.hh:41
std::optional< int > LineNumber() const
Get the line number associated with this error.
@ URI_INVALID
A URI is invalid.
@ ATTRIBUTE_INVALID
This error indicates that an SDF attribute is invalid.
@ POSE_RELATIVE_TO_INVALID
The pose relative-to value does not match the name of an existing frame in the current scope.
@ MODEL_PLACEMENT_FRAME_INVALID
The specified placement frame is invalid.
@ ATTRIBUTE_INCORRECT_TYPE
Indicates an attribute was included that is not part of the sdf spec.
@ NESTED_MODELS_UNSUPPORTED
Indicates that a DOM object tried to read a nested model.
@ STRING_READ
Indicates that reading an SDF string failed.
@ POSE_RELATIVE_TO_GRAPH_ERROR
The pose relative-to graph has an internal error.
@ VERSION_DEPRECATED
The provided version has been deprecated or it is pre-versioning.
@ ELEMENT_INCORRECT_TYPE
Indicates that an incorrect SDF element type was encountered.
std::optional< std::string > FilePath() const
Get the file path associated with this error.
@ FILE_READ
Indicates that reading an SDF file failed.
ErrorCode
Definition: Error.hh:46
@ JOINT_PARENT_SAME_AS_CHILD
A joint has the same link specified as parent and child.
@ FRAME_ATTACHED_TO_GRAPH_ERROR
The frame attached-to graph has an internal error.
@ FRAME_ATTACHED_TO_INVALID
The frame attached-to value does not match the name of an existing frame in the current scope.
@ ELEMENT_MISSING
Indicates that a required SDF element is missing.
@ ATTRIBUTE_MISSING
Indicates that a required SDF attribute is missing.
@ LINK_INERTIA_INVALID
A link has invalid inertia.
@ RESERVED_NAME
A reserved name was used in an entity name attribute.
@ MODEL_CANONICAL_LINK_INVALID
A model with an invalid canonical link.
@ ELEMENT_DEPRECATED
This error indicates that an SDF element is deprecated.
@ ATTRIBUTE_DEPRECATED
This error indicates that an SDF attribute is deprecated.