Commit 898a4b5c authored by mercury233's avatar mercury233

update exception handling

parent 874ea094
...@@ -182,6 +182,7 @@ namespace ImgGen ...@@ -182,6 +182,7 @@ namespace ImgGen
data.attribute = (Attribute)reader.GetInt32(9); data.attribute = (Attribute)reader.GetInt32(9);
} }
reader.Close(); reader.Close();
reader = null; // for Exception -> finally GC
command.CommandText = $"SELECT * FROM texts WHERE id={code}"; command.CommandText = $"SELECT * FROM texts WHERE id={code}";
reader = command.ExecuteReader(); reader = command.ExecuteReader();
...@@ -196,6 +197,9 @@ namespace ImgGen ...@@ -196,6 +197,9 @@ namespace ImgGen
return DrawCard(data, text); return DrawCard(data, text);
} }
catch (Exception e) catch (Exception e)
#if DEBUG
when (false)
#endif
{ {
Console.WriteLine($"Error when parsing {code} - {e}"); Console.WriteLine($"Error when parsing {code} - {e}");
return null; return null;
...@@ -246,6 +250,9 @@ namespace ImgGen ...@@ -246,6 +250,9 @@ namespace ImgGen
image = new Bitmap(filename); image = new Bitmap(filename);
} }
catch (Exception e) catch (Exception e)
#if DEBUG
when (false)
#endif
{ {
Console.WriteLine($"Error when parsing {data.code} - {e}"); Console.WriteLine($"Error when parsing {data.code} - {e}");
return; return;
......
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