\brief Thrown if an error occurs while attempting to load a binary module
| 135 | { |
| 136 | /// \brief Thrown if an error occurs while attempting to load a binary module |
| 137 | struct load_module_error : std::runtime_error |
| 138 | { |
| 139 | explicit load_module_error(const std::string &t_reason) noexcept |
| 140 | : std::runtime_error(t_reason) |
| 141 | { |
| 142 | } |
| 143 | |
| 144 | load_module_error(const std::string &t_name, const std::vector<load_module_error> &t_errors) |
| 145 | : std::runtime_error(format_error(t_name, t_errors)) |
| 146 | { |
| 147 | } |
| 148 | |
| 149 | load_module_error(const load_module_error &) = default; |
| 150 | ~load_module_error() noexcept override = default; |
| 151 | |
| 152 | static std::string format_error(const std::string &t_name, const std::vector<load_module_error> &t_errors) |
| 153 | { |
| 154 | std::stringstream ss; |
| 155 | ss << "Error loading module '" << t_name << "'\n" |
| 156 | << " The following locations were searched:\n"; |
| 157 | |
| 158 | for (const auto &err : t_errors) { |
| 159 | ss << " " << err.what() << "\n"; |
| 160 | } |
| 161 | |
| 162 | return ss.str(); |
| 163 | } |
| 164 | }; |
| 165 | |
| 166 | |
| 167 | /// Errors generated during parsing or evaluation |
no outgoing calls
no test coverage detected