[banshee] [Hyena.Data.Sqlite] Make some error msgs more useful



commit 9da8b838adbbb1531e0c5a15f38932e7404c880d
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Tue Mar 9 13:23:45 2010 -0800

    [Hyena.Data.Sqlite] Make some error msgs more useful

 .../Hyena/Hyena.Data.Sqlite/HyenaSqliteCommand.cs  |    2 +-
 .../Hyena/Hyena.Data.Sqlite/SqliteUtils.cs         |    6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/Libraries/Hyena/Hyena.Data.Sqlite/HyenaSqliteCommand.cs b/src/Libraries/Hyena/Hyena.Data.Sqlite/HyenaSqliteCommand.cs
index b80ecbd..a550d0a 100644
--- a/src/Libraries/Hyena/Hyena.Data.Sqlite/HyenaSqliteCommand.cs
+++ b/src/Libraries/Hyena/Hyena.Data.Sqlite/HyenaSqliteCommand.cs
@@ -189,7 +189,7 @@ namespace Hyena.Data.Sqlite
 
             if (param_values.Length != parameter_count) {
                 throw new ArgumentException (String.Format (
-                    "Command has {0} parameters, but {1} values given.", parameter_count, param_values.Length
+                    "Command {2} has {0} parameters, but {1} values given.", parameter_count, param_values.Length, command
                 ));
             }
 
diff --git a/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteUtils.cs b/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteUtils.cs
index c9083c2..5095a0d 100644
--- a/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteUtils.cs
+++ b/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteUtils.cs
@@ -156,7 +156,11 @@ namespace Hyena.Data.Sqlite
 
         public override object Invoke (object[] args)
         {
-            return funcs[args[0] as string] (args[1], args[2]);
+            Func<object, object, object> func;
+            if (!funcs.TryGetValue (args[0] as string, out func))
+                throw new ArgumentException (args[0] as string, "HYENA_BINARY_FUNCTION name (arg 0)");
+
+            return func (args[1], args[2]);
         }
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]