MCPcopy Create free account
hub / github.com/WebAssembly/wabt / PrintError

Method PrintError

src/binary-reader.cc:239–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237}
238
239void WABT_PRINTF_FORMAT(2, 3) BinaryReader::PrintError(const char* format,
240 ...) {
241 ErrorLevel error_level =
242 reading_custom_section_ && !options_.fail_on_custom_section_error
243 ? ErrorLevel::Warning
244 : ErrorLevel::Error;
245
246 WABT_SNPRINTF_ALLOCA(buffer, length, format);
247 Error error(error_level, Location(state_.offset), std::string_view(), buffer);
248 bool handled = delegate_->OnError(error);
249
250 if (!handled) {
251 // Not great to just print, but we don't want to eat the error either.
252 fprintf(stderr, "%07" PRIzx ": %s: %s\n", state_.offset,
253 GetErrorLevelName(error_level), buffer);
254 }
255}
256
257Result BinaryReader::ReportUnexpectedOpcode(Opcode opcode, const char* where) {
258 std::string message = "unexpected opcode";

Callers

nothing calls this directly

Calls 3

LocationClass · 0.85
GetErrorLevelNameFunction · 0.85
OnErrorMethod · 0.45

Tested by

no test coverage detected