summaryrefslogtreecommitdiff
path: root/src/error-handler.h
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2018-05-16 19:21:19 -0700
committerGitHub <noreply@github.com>2018-05-16 19:21:19 -0700
commit1fec702978b82945f5e6097f765d505f25f30097 (patch)
treec1df59bd7fdfc8609c1eac150e3dd5a85854c1c7 /src/error-handler.h
parentdd7663d78bf483308cd8d70d114748321f2cd61f (diff)
downloadwabt-1fec702978b82945f5e6097f765d505f25f30097.tar.gz
wabt-1fec702978b82945f5e6097f765d505f25f30097.tar.bz2
wabt-1fec702978b82945f5e6097f765d505f25f30097.zip
Print "warning" for ignored custom section errors (#843)
The previous message said "error", which makes it look like the output is not created, so change the message to "warning" instead. The error handling code is pretty ugly and can use a refactor, but that would be a much larger change.
Diffstat (limited to 'src/error-handler.h')
-rw-r--r--src/error-handler.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/error-handler.h b/src/error-handler.h
index 5bee0639..cc407993 100644
--- a/src/error-handler.h
+++ b/src/error-handler.h
@@ -31,20 +31,24 @@ class ErrorHandler {
virtual ~ErrorHandler() {}
// Returns true if the error was handled.
- virtual bool OnError(const Location&,
+ virtual bool OnError(ErrorLevel,
+ const Location&,
const std::string& error,
const std::string& source_line,
size_t source_line_column_offset) = 0;
// Helper function for binary locations.
- bool OnError(size_t offset, const std::string& error) {
- return OnError(Location(offset), error, std::string(), 0);
+ bool OnError(ErrorLevel error_level,
+ size_t offset,
+ const std::string& error) {
+ return OnError(error_level, Location(offset), error, std::string(), 0);
}
// OnError will be called with with source_line trimmed to this length.
virtual size_t source_line_max_length() const = 0;
- std::string DefaultErrorMessage(const Color&,
+ std::string DefaultErrorMessage(ErrorLevel,
+ const Color&,
const Location&,
const std::string& error,
const std::string& source_line,
@@ -59,7 +63,8 @@ class ErrorHandlerNop : public ErrorHandler {
public:
ErrorHandlerNop();
- bool OnError(const Location&,
+ bool OnError(ErrorLevel,
+ const Location&,
const std::string& error,
const std::string& source_line,
size_t source_line_column_offset) override {
@@ -83,7 +88,8 @@ class ErrorHandlerFile : public ErrorHandler {
PrintHeader print_header = PrintHeader::Never,
size_t source_line_max_length = 80);
- bool OnError(const Location&,
+ bool OnError(ErrorLevel,
+ const Location&,
const std::string& error,
const std::string& source_line,
size_t source_line_column_offset) override;
@@ -107,7 +113,8 @@ class ErrorHandlerBuffer : public ErrorHandler {
explicit ErrorHandlerBuffer(Location::Type,
size_t source_line_max_length = 80);
- bool OnError(const Location&,
+ bool OnError(ErrorLevel,
+ const Location&,
const std::string& error,
const std::string& source_line,
size_t source_line_column_offset) override;