Skip to content

Commit

Permalink
GH-3530: Ensure all DbDataReader.TryGet extention methods catch all t…
Browse files Browse the repository at this point in the history
…ypes of exceptions.
  • Loading branch information
David Ellingsworth authored and David Ellingsworth committed Jun 11, 2024
1 parent 3d8bc0e commit bc82ebe
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/NHibernate/AdoNet/DbRecordSetExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static bool TryGetBoolean(this DbDataReader rs, int ordinal, out bool val
value = rs.GetBoolean(ordinal);
return true;
}
catch (InvalidCastException)
catch (Exception)
{
value = default;
return false;
Expand All @@ -26,7 +26,7 @@ public static bool TryGetByte(this DbDataReader rs, int ordinal, out byte value)
value = rs.GetByte(ordinal);
return true;
}
catch (InvalidCastException)
catch (Exception)
{
value = default;
return false;
Expand All @@ -40,7 +40,7 @@ public static bool TryGetChar(this DbDataReader rs, int ordinal, out char value)
value = rs.GetChar(ordinal);
return true;
}
catch (InvalidCastException)
catch (Exception)
{
value = default;
return false;
Expand All @@ -54,7 +54,7 @@ public static bool TryGetDecimal(this DbDataReader rs, int ordinal, out decimal
value = rs.GetDecimal(ordinal);
return true;
}
catch (InvalidCastException)
catch (Exception)
{
value = default;
return false;
Expand All @@ -68,7 +68,7 @@ public static bool TryGetDouble(this DbDataReader rs, int ordinal, out double va
value = rs.GetDouble(ordinal);
return true;
}
catch (InvalidCastException)
catch (Exception)
{
value = default;
return false;
Expand All @@ -82,7 +82,7 @@ public static bool TryGetDateTime(this DbDataReader rs, int ordinal, out DateTim
value = rs.GetDateTime(ordinal);
return true;
}
catch (InvalidCastException)
catch (Exception)
{
value = default;
return false;
Expand All @@ -95,7 +95,7 @@ public static bool TryGetFloat(this DbDataReader rs, int ordinal, out float valu
value = rs.GetFloat(ordinal);
return true;
}
catch (InvalidCastException)
catch (Exception)
{
value = default;
return false;
Expand All @@ -108,7 +108,7 @@ public static bool TryGetGuid(this DbDataReader rs, int ordinal, out Guid value)
value = rs.GetGuid(ordinal);
return true;
}
catch (InvalidCastException)
catch (Exception)
{
value = default;
return false;
Expand Down Expand Up @@ -136,7 +136,7 @@ public static bool TryGetInt16(this DbDataReader rs, int ordinal, out short valu
value = rs.GetInt16(ordinal);
return true;
}
catch (InvalidCastException)
catch (Exception)
{
value = default;
return false;
Expand All @@ -149,7 +149,7 @@ public static bool TryGetInt32(this DbDataReader rs, int ordinal, out int value)
value = rs.GetInt32(ordinal);
return true;
}
catch (InvalidCastException)
catch (Exception)
{
value = default;
return false;
Expand Down Expand Up @@ -177,7 +177,7 @@ public static bool TryGetInt64(this DbDataReader rs, int ordinal, out long value
value = rs.GetInt64(ordinal);
return true;
}
catch (InvalidCastException)
catch (Exception)
{
value = default;
return false;
Expand Down Expand Up @@ -219,7 +219,7 @@ public static bool TryGetString(this DbDataReader rs, int ordinal, out string va
value = rs.GetString(ordinal);
return true;
}
catch (InvalidCastException)
catch (Exception)
{
value = default;
return false;
Expand Down

0 comments on commit bc82ebe

Please sign in to comment.