Index: runtime/vm/regexp_parser.cc |
diff --git a/runtime/vm/regexp_parser.cc b/runtime/vm/regexp_parser.cc |
index 003e554646dd683854d696ad1e061eb00510d10b..a0f114b49f54049d1cce5a9065a2f3831b27250f 100644 |
--- a/runtime/vm/regexp_parser.cc |
+++ b/runtime/vm/regexp_parser.cc |
@@ -267,10 +267,15 @@ bool RegExpParser::ParseRegExp(const String& input, |
result->capture_count = capture_count; |
} else { |
ASSERT(!result->error.IsNull()); |
- |
- // TODO(jgruber): Throw a format exception once we are ready to replace |
- // jscre. For now, we ignore the error set by LongJump. |
Isolate::Current()->object_store()->clear_sticky_error(); |
+ |
+ // Throw a FormatException on parsing failures. |
+ const String& message = String::Handle( |
+ String::Concat(result->error, input)); |
+ const Array& args = Array::Handle(Array::New(1)); |
+ args.SetAt(0, message); |
+ |
+ Exceptions::ThrowByType(Exceptions::kFormat, args); |
} |
return !parser.failed(); |
} |