Index: src/wasm/wasm-result.h |
diff --git a/src/wasm/wasm-result.h b/src/wasm/wasm-result.h |
index f16c15906dfa896941afa798f26d517984b32a74..efe269a86828ee6b2b498c7ef8e2ed2b582f970a 100644 |
--- a/src/wasm/wasm-result.h |
+++ b/src/wasm/wasm-result.h |
@@ -99,31 +99,35 @@ std::ostream& operator<<(std::ostream& os, const ErrorCode& error_code); |
// A helper for generating error messages that bubble up to JS exceptions. |
class ErrorThrower { |
public: |
- ErrorThrower(Isolate* isolate, const char* context) |
+ ErrorThrower(i::Isolate* isolate, const char* context) |
: isolate_(isolate), context_(context) {} |
~ErrorThrower(); |
PRINTF_FORMAT(2, 3) void Error(const char* fmt, ...); |
+ PRINTF_FORMAT(2, 3) void TypeError(const char* fmt, ...); |
+ PRINTF_FORMAT(2, 3) void RangeError(const char* fmt, ...); |
template <typename T> |
void Failed(const char* error, Result<T>& result) { |
std::ostringstream str; |
str << error << result; |
- return Error("%s", str.str().c_str()); |
+ Error("%s", str.str().c_str()); |
} |
- i::Handle<i::String> Reify() { |
- auto result = message_; |
- message_ = i::Handle<i::String>(); |
+ i::Handle<i::Object> Reify() { |
+ i::Handle<i::Object> result = exception_; |
+ exception_ = i::Handle<i::Object>::null(); |
return result; |
} |
- bool error() const { return !message_.is_null(); } |
+ bool error() const { return !exception_.is_null(); } |
private: |
- Isolate* isolate_; |
+ void Format(i::Handle<i::JSFunction> constructor, const char* fmt, va_list); |
+ |
+ i::Isolate* isolate_; |
const char* context_; |
- i::Handle<i::String> message_; |
+ i::Handle<i::Object> exception_; |
}; |
} // namespace wasm |
} // namespace internal |