scenario_simulator_v2 C++ API
error.hpp
Go to the documentation of this file.
1 // Copyright 2015 TIER IV, Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef OPENSCENARIO_INTERPRETER__ERROR_HPP_
16 #define OPENSCENARIO_INTERPRETER__ERROR_HPP_
17 
18 #include <exception>
19 #include <iomanip>
22 #include <stdexcept>
23 
24 #define LINE() \
25  std::cout << "\x1b[33m" __FILE__ "\x1b[31m:\x1b[36m" << __LINE__ << "\x1b[0m" << std::endl
26 
27 #define PRINT(...) std::cout << #__VA_ARGS__ " = " << std::boolalpha << (__VA_ARGS__) << std::endl
28 
30 {
32 using common::Error;
36 
37 #define INVALID_NUMERIC_LITERAL_SPECIFIED(VALUE) \
38  SyntaxError( \
39  "Given value ", std::quoted(VALUE), " is not an external representation of type ", \
40  demangle(typeid(*this)))
41 
42 #define UNSUPPORTED_ENUMERATION_VALUE_SPECIFIED(TYPE, VALUE) \
43  SyntaxError( \
44  "Given value ", std::quoted(VALUE), \
45  " is valid OpenSCENARIO value of type " #TYPE ", but it is not supported yet")
46 
47 #define UNEXPECTED_ENUMERATION_VALUE_SPECIFIED(TYPE, VALUE) \
48  SyntaxError("Unexpected value ", std::quoted(VALUE), " of type " #TYPE " was specified")
49 
50 #define UNEXPECTED_ENUMERATION_VALUE_ASSIGNED(TYPE, VALUE) \
51  SyntaxError( \
52  "Unexpected value ", static_cast<TYPE::value_type>(VALUE), " was assigned to type " #TYPE)
53 
54 #define UNSUPPORTED_ELEMENT_SPECIFIED(ELEMENT) \
55  SyntaxError( \
56  "Given class ", ELEMENT, " is valid OpenSCENARIO element of class ", demangle(typeid(*this)), \
57  ", but is not supported yet")
58 
59 #define UNSUPPORTED_CONVERSION_DETECTED(FROM, TO) \
60  SyntaxError("Converting " #FROM " to " #TO \
61  ". This is valid in OpenSCENARIO standard, but is not yet supported")
62 
63 #define UNSUPPORTED_SETTING_DETECTED(ACTION_OR_CONDITION, ELEMENT) \
64  SyntaxError(#ACTION_OR_CONDITION " does not yet support ", ELEMENT)
65 } // namespace openscenario_interpreter
66 
67 #endif // OPENSCENARIO_INTERPRETER__ERROR_HPP_
Definition: escape_sequence.hpp:22
Autoware encountered some problem that led to a simulation failure.
Definition: exception.hpp:41
Definition: exception.hpp:27
Although there were no syntactic errors in the description of the scenario, differences in meaning an...
Definition: exception.hpp:44
A problem occurred that interfered with the continuation of the simulation.
Definition: exception.hpp:47
There is a syntactic error in the description of the scenario. Or you are using a feature that is not...
Definition: exception.hpp:53