summary refs log tree commit diff stats
path: root/generator/word.h
diff options
context:
space:
mode:
Diffstat (limited to 'generator/word.h')
-rw-r--r--generator/word.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/generator/word.h b/generator/word.h index 2e469d4..2818202 100644 --- a/generator/word.h +++ b/generator/word.h
@@ -1,7 +1,7 @@
1#ifndef WORD_H_91F99D46 1#ifndef WORD_H_91F99D46
2#define WORD_H_91F99D46 2#define WORD_H_91F99D46
3 3
4#include <cassert> 4#include <stdexcept>
5#include <hkutil/database.h> 5#include <hkutil/database.h>
6#include "../lib/enums.h" 6#include "../lib/enums.h"
7 7
@@ -61,8 +61,10 @@ namespace verbly {
61 61
62 int getTagCount() const 62 int getTagCount() const
63 { 63 {
64 // Calling code should always call hasTagCount first. 64 if (!hasTagCount_)
65 assert(hasTagCount_); 65 {
66 throw std::domain_error("Word does not have a tag count");
67 }
66 68
67 return tagCount_; 69 return tagCount_;
68 } 70 }
@@ -79,8 +81,10 @@ namespace verbly {
79 81
80 const group& getVerbGroup() const 82 const group& getVerbGroup() const
81 { 83 {
82 // Calling code should always call hasVerbGroup first. 84 if (!hasVerbGroup())
83 assert(verbGroup_ != nullptr); 85 {
86 throw std::domain_error("Word does not have a verb group");
87 }
84 88
85 return *verbGroup_; 89 return *verbGroup_;
86 } 90 }