Exceptions.h
Go to the documentation of this file.
1 #pragma once
2 #include <stdexcept>
3 #include <vector>
4 
5 namespace lanelet {
6 
11 class LaneletError : public std::runtime_error {
12  using std::runtime_error::runtime_error;
13 };
14 
21  public:
22  using ErrorMessages = std::vector<std::string>;
23  explicit LaneletMultiError(const std::string& err) : LaneletError(err), errorMessages{{err}} {}
24  explicit LaneletMultiError(ErrorMessages messages = {})
25  : LaneletError(combineErrors(messages)), errorMessages(std::move(messages)) {}
27 
28  private:
29  static std::string combineErrors(const ErrorMessages& m) {
30  std::string result;
31  for (const auto& message : m) {
32  result += message;
33  result += '\n';
34  }
35  return result;
36  }
37 };
38 
43  using LaneletError::LaneletError;
44 };
45 
50  using LaneletError::LaneletError;
51 };
52 
57  using LaneletError::LaneletError;
58 };
59 
63 class GeometryError : public LaneletError {
64  using LaneletError::LaneletError;
65 };
66 
72  using LaneletError::LaneletError;
73 };
74 
80 class NullptrError : public LaneletError {
81  using LaneletError::LaneletError;
82 };
83 
84 } // namespace lanelet
Thrown when multiple errors occur at the same time.
Definition: Exceptions.h:20
Thrown when a geometric operation is not valid.
Definition: Exceptions.h:63
Thrown when an element is not part of the map.
Definition: Exceptions.h:49
Thrown when the state of a lanelet object is invalid E.g. when an linestring has no points or member ...
Definition: Exceptions.h:71
LaneletMultiError(const std::string &err)
Definition: Exceptions.h:23
LaneletMultiError(ErrorMessages messages={})
Definition: Exceptions.h:24
SharedPtrs in lanelet2 must never point to null. If this is violated, this exception is thrown (usual...
Definition: Exceptions.h:80
std::vector< std::string > ErrorMessages
Definition: Exceptions.h:22
const ErrorMessages errorMessages
The individual error strings.
Definition: Exceptions.h:26
Thrown when a function was called with invalid input arguments.
Definition: Exceptions.h:56
Generic lanelet error class. All errors lanelet2 will throw derive from this type.
Definition: Exceptions.h:11
Thrown when an attribute has been queried that does not exist.
Definition: Exceptions.h:42
static std::string combineErrors(const ErrorMessages &m)
Definition: Exceptions.h:29


lanelet2_core
Author(s): Fabian Poggenhans
autogenerated on Tue Jun 6 2023 02:23:32