From 7afae8fbb8367159e7ff2629d1020b79be1ab836 Mon Sep 17 00:00:00 2001 From: skilion Date: Thu, 24 Sep 2015 19:12:19 +0200 Subject: [PATCH] correct way to test if a value is in the AA --- src/config.d | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config.d b/src/config.d index f3af8308..e5ada935 100644 --- a/src/config.d +++ b/src/config.d @@ -18,10 +18,10 @@ struct Config string get(string key) { - import core.exception; - try { - return values[key]; - } catch (RangeError e) { + auto p = key in values; + if (p) { + return *p; + } else { throw new Exception("Missing config value: " ~ key); } }