From 9bbe7b8b4d33bce3fb4c06b88f00926b5b38bcec Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 19 Aug 2017 15:31:46 -0600 Subject: [PATCH] ircd::db: Add schema_error exception; use for bad column names. --- include/ircd/db.h | 1 + include/ircd/db/row.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/ircd/db.h b/include/ircd/db.h index 6fcc860b1..bd848f235 100644 --- a/include/ircd/db.h +++ b/include/ircd/db.h @@ -41,6 +41,7 @@ struct database; // IRCD_EXCEPTION(ircd::error, error) IRCD_EXCEPTION(error, not_found) +IRCD_EXCEPTION(error, schema_error) IRCD_EXCEPTION_HIDENAME(error, corruption) IRCD_EXCEPTION_HIDENAME(error, not_supported) IRCD_EXCEPTION_HIDENAME(error, invalid_argument) diff --git a/include/ircd/db/row.h b/include/ircd/db/row.h index 8c9311548..9b7997129 100644 --- a/include/ircd/db/row.h +++ b/include/ircd/db/row.h @@ -146,7 +146,7 @@ ircd::db::row::operator[](const string_view &column) { const auto it(find(column)); if(unlikely(it == end())) - throw not_found("column '%s' does not exist", column); + throw schema_error("column '%s' not specified in the descriptor schema", column); return *it; } @@ -157,7 +157,7 @@ const { const auto it(find(column)); if(unlikely(it == end())) - throw not_found("column '%s' does not exist", column); + throw schema_error("column '%s' not specified in the descriptor schema", column); return *it; }