Commit ecf9ee3c authored by mgravell's avatar mgravell

more detail in error

parent 48b0b7fb
...@@ -758,8 +758,21 @@ private static object GetStructDeserializer<T>(IDataReader reader) ...@@ -758,8 +758,21 @@ private static object GetStructDeserializer<T>(IDataReader reader)
} }
public static void ThrowDataException(Exception ex, int index, IDataReader reader) public static void ThrowDataException(Exception ex, int index, IDataReader reader)
{ {
string name = reader != null && index >= 0 && index < reader.FieldCount ? reader.GetName(index) : "(n/a)"; string name = "(n/a)", value = "(n/a)";
throw new DataException(string.Format("Error parsing column {0} ({1})", index, name), ex); if (reader != null && index >= 0 && index < reader.FieldCount)
{
name = reader.GetName(index);
object val = reader.GetValue(index);
if (val == null || val is DBNull)
{
value = "<null>";
}
else
{
value = Convert.ToString(val) + " - " + Type.GetTypeCode(val.GetType());
}
}
throw new DataException(string.Format("Error parsing column {0} ({1}={2})", index, name,value), ex);
} }
private static void EmitInt32(ILGenerator il, int value) private static void EmitInt32(ILGenerator il, int value)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment