diff options
author | Ben Smith <binji@chromium.org> | 2018-09-03 13:08:23 -0700 |
---|---|---|
committer | Ben Smith <binjimin@gmail.com> | 2018-09-04 15:13:23 -0700 |
commit | e0719fe0fe504c497d9fb7510fe68499c08179f4 (patch) | |
tree | 1e2f3d3b4ac76b239bb75a6f819d8fd1f1cc8050 /src/binary-reader-logging.cc | |
parent | b4125e90c70a6b1bef4480e33f3c838ab4c7cfcb (diff) | |
download | wabt-e0719fe0fe504c497d9fb7510fe68499c08179f4.tar.gz wabt-e0719fe0fe504c497d9fb7510fe68499c08179f4.tar.bz2 wabt-e0719fe0fe504c497d9fb7510fe68499c08179f4.zip |
Replace ErrorHandler with Errors and FormatErrors*
`ErrorHandler` complicated all error handling in wabt, since it was
callback-based. Callbacks would be useful if we ever wanted to change
behavior when an error occurred, but instead all that the handler ever
did was write the errors to stdout/stderr or to a buffer.
This change adds a new class `Error`, which contains an `ErrorLevel`, a
`Location` and an error message. It also replaces ErrorHandler with
`Errors` (a typedef for `std::vector<Error>`), and adds a couple of
functions that can format a list of `Errors` for output:
`FormatErrorsTo{String,File}`.
Diffstat (limited to 'src/binary-reader-logging.cc')
-rw-r--r-- | src/binary-reader-logging.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/binary-reader-logging.cc b/src/binary-reader-logging.cc index 8010aac5..7edebdd1 100644 --- a/src/binary-reader-logging.cc +++ b/src/binary-reader-logging.cc @@ -99,8 +99,8 @@ void BinaryReaderLogging::LogTypes(TypeVector& types) { LogTypes(types.size(), types.data()); } -bool BinaryReaderLogging::OnError(ErrorLevel error_level, const char* message) { - return reader_->OnError(error_level, message); +bool BinaryReaderLogging::OnError(const Error& error) { + return reader_->OnError(error); } void BinaryReaderLogging::OnSetState(const State* s) { |