From e0f00a71123c46887b2ecdb2e83b9381309def78 Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Sun, 4 Jul 2010 07:43:15 +0000 Subject: [PATCH] Error message improved in LoadById --- Core/DB/IDBConnection.cs | 2 +- Core/exceptions/NotFoundInDBException.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Core/DB/IDBConnection.cs b/Core/DB/IDBConnection.cs index 8565d75..58c270c 100644 --- a/Core/DB/IDBConnection.cs +++ b/Core/DB/IDBConnection.cs @@ -47,7 +47,7 @@ namespace FLocal.Core.DB { public static Dictionary LoadById(this IDBConnection connection, ITableSpec table, string id) { List> rows = connection.LoadByIds(table, new List { id }); if(rows.Count < 1) { - throw new NotFoundInDBException(); + throw new NotFoundInDBException(table, id); } if(rows.Count > 1) { throw new CriticalException(rows.Count + " objects with specified id"); diff --git a/Core/exceptions/NotFoundInDBException.cs b/Core/exceptions/NotFoundInDBException.cs index 61db15e..e4d37c8 100644 --- a/Core/exceptions/NotFoundInDBException.cs +++ b/Core/exceptions/NotFoundInDBException.cs @@ -9,6 +9,8 @@ namespace FLocal.Core { public NotFoundInDBException() : base("Object not found in DB") { } + public NotFoundInDBException(DB.ITableSpec tableSpec, string id) : base("Object " + tableSpec.name + "[" + tableSpec.idName + "=" + id + "] not found in db") {} + } }