From 8b95516aef0cd4bd98e2592d6f247882dc88886a Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 31 Mar 2018 23:11:20 -0400 Subject: Converted asserts in generator to exceptions --- generator/pronunciation.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'generator/pronunciation.h') diff --git a/generator/pronunciation.h b/generator/pronunciation.h index 163e55e..3190e6d 100644 --- a/generator/pronunciation.h +++ b/generator/pronunciation.h @@ -2,8 +2,8 @@ #define PRONUNCIATION_H_584A08DD #include -#include #include +#include namespace verbly { namespace generator { @@ -34,16 +34,20 @@ namespace verbly { std::string getRhymePhonemes() const { - // Calling code should always call hasRhyme first. - assert(!rhyme_.empty()); + if (rhyme_.empty()) + { + throw std::domain_error("Pronunciation does not have a rhyme"); + } return rhyme_; } std::string getPrerhyme() const { - // Calling code should always call hasRhyme first. - assert(!rhyme_.empty()); + if (rhyme_.empty()) + { + throw std::domain_error("Pronunciation does not have a rhyme"); + } return prerhyme_; } -- cgit 1.4.1