From fdcbcfeda4b37375a085e54f8a1583e58804abc4 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Sat, 25 Mar 2023 13:05:04 +0200 Subject: [PATCH] ConnInfo - `getDB(string)` will now throw `BirchwoodException` with `ErrorType.DB_KEY_NOT_FOUND` if the key is not found Exceptions - Added member `DB_KEY_NOT_FOUND` to `ErrorType` enum --- source/birchwood/client/exceptions.d | 7 ++++++- source/birchwood/config/conninfo.d | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/source/birchwood/client/exceptions.d b/source/birchwood/client/exceptions.d index db01916..1005708 100644 --- a/source/birchwood/client/exceptions.d +++ b/source/birchwood/client/exceptions.d @@ -66,7 +66,12 @@ public enum ErrorType * If invalid parameters are passed * to any of the text formatting functions */ - INVALID_FORMATTING + INVALID_FORMATTING, + + /** + * If a key-lookup in the ConnInfo failed + */ + DB_KEY_NOT_FOUND } /** diff --git a/source/birchwood/config/conninfo.d b/source/birchwood/config/conninfo.d index 934fc98..c6e921b 100644 --- a/source/birchwood/config/conninfo.d +++ b/source/birchwood/config/conninfo.d @@ -136,8 +136,7 @@ public shared struct ConnectionInfo } else { - // TODO: Should throw an exception - return ""; + throw new BirchwoodException(ErrorType.DB_KEY_NOT_FOUND, "Could not find key '"~key~"'"); } }