Skip to content

Commit efea4ec

Browse files
committed
Adding proper exception handling
1 parent b6c87cf commit efea4ec

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Authorize.NET/Util/HttpUtility.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,14 @@ public static ANetApiResponse PostData<TQ, TS>(AuthorizeNet.Environment env, TQ
8484
{
8585
while (!reader.EndOfStream)
8686
{
87-
result.Append((char)reader.Read());
87+
try
88+
{
89+
result.Append((char)reader.Read());
90+
}
91+
catch (Exception)
92+
{
93+
throw new Exception("Cannot read response.");
94+
}
8895

8996
if (result.Length >= MaxResponseLength)
9097
{

0 commit comments

Comments
 (0)