Skip to content

Commit 5eb9ed6

Browse files
committed
error trapping on initial compile
1 parent f6afb9b commit 5eb9ed6

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

RegexPlanet-DotNet/Test.aspx.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,21 @@ protected void Page_Load(object sender, EventArgs e)
6868
sb.Append("</td>");
6969
sb.AppendLine("\t\t</tr>");
7070

71-
Regex regularExpression = new Regex(regEx, options);
71+
Regex regularExpression = null;
72+
try
73+
{
74+
regularExpression = new Regex(regEx, options);
75+
}
76+
catch (Exception e)
77+
{
78+
sb.AppendLine("\t\t<tr>");
79+
sb.AppendLine("\t\t\t<td>Error</td>");
80+
sb.Append("\t\t\t<td>");
81+
sb.Append(Server.HtmlEncode(e.Message));
82+
sb.Append("</td>");
83+
sb.AppendLine("\t\t</tr>");
84+
}
85+
7286
int groupCount = 0;
7387
if (regularExpression != null)
7488
{

0 commit comments

Comments
 (0)