Skip to content

Commit da5e19d

Browse files
committed
trap timeout error
1 parent d263145 commit da5e19d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

RegexPlanet-DotNet/Test.aspx.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,16 @@ protected void Page_Load(object sender, EventArgs e)
127127
sb.Append(Server.HtmlEncode(test));
128128
sb.AppendLine("</td>");
129129

130-
Match m = Regex.Match(test, regEx, options, timeout);
130+
Match m = null;
131+
try
132+
{
133+
m = Regex.Match(test, regEx, options, timeout);
134+
}
135+
catch (RegexMatchTimeoutException rmte)
136+
{
137+
sb.AppendLine("\t\t\t<td colspan=\"3\">ERROR: RegexMatchTimeoutException</td>");
138+
sb.AppendLine("\t\t</tr>");
139+
}
131140

132141
sb.Append("\t\t\t<td>");
133142
sb.Append(Server.HtmlEncode(BooleanToString(m.Success)));

0 commit comments

Comments
 (0)