summary refs log tree commit diff stats
path: root/generator/pronunciation.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-03-31 23:11:20 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-03-31 23:11:20 -0400
commit8b95516aef0cd4bd98e2592d6f247882dc88886a (patch)
tree27d13676d0fbe075c9eb576037c9a117769533e3 /generator/pronunciation.h
parent75e947fa0021547f460496d1c3aef5b61af4c669 (diff)
downloadverbly-8b95516aef0cd4bd98e2592d6f247882dc88886a.tar.gz
verbly-8b95516aef0cd4bd98e2592d6f247882dc88886a.tar.bz2
verbly-8b95516aef0cd4bd98e2592d6f247882dc88886a.zip
Converted asserts in generator to exceptions
Diffstat (limited to 'generator/pronunciation.h')
-rw-r--r--generator/pronunciation.h14
1 files changed, 9 insertions, 5 deletions
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 @@
2#define PRONUNCIATION_H_584A08DD 2#define PRONUNCIATION_H_584A08DD
3 3
4#include <string> 4#include <string>
5#include <cassert>
6#include <hkutil/database.h> 5#include <hkutil/database.h>
6#include <stdexcept>
7 7
8namespace verbly { 8namespace verbly {
9 namespace generator { 9 namespace generator {
@@ -34,16 +34,20 @@ namespace verbly {
34 34
35 std::string getRhymePhonemes() const 35 std::string getRhymePhonemes() const
36 { 36 {
37 // Calling code should always call hasRhyme first. 37 if (rhyme_.empty())
38 assert(!rhyme_.empty()); 38 {
39 throw std::domain_error("Pronunciation does not have a rhyme");
40 }
39 41
40 return rhyme_; 42 return rhyme_;
41 } 43 }
42 44
43 std::string getPrerhyme() const 45 std::string getPrerhyme() const
44 { 46 {
45 // Calling code should always call hasRhyme first. 47 if (rhyme_.empty())
46 assert(!rhyme_.empty()); 48 {
49 throw std::domain_error("Pronunciation does not have a rhyme");
50 }
47 51
48 return prerhyme_; 52 return prerhyme_;
49 } 53 }