diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/socket.cpp | 4 | ||||
-rw-r--r-- | src/tafnode.cpp | 32 |
2 files changed, 30 insertions, 6 deletions
diff --git a/src/socket.cpp b/src/socket.cpp index c93ec6e..c57d97e 100644 --- a/src/socket.cpp +++ b/src/socket.cpp | |||
@@ -89,8 +89,8 @@ Bu::Socket::Socket( const Bu::FString &sAddr, int nPort, int nTimeout ) | |||
89 | sprintf( ibuf, "%d", nPort ); | 89 | sprintf( ibuf, "%d", nPort ); |
90 | 90 | ||
91 | int ret; | 91 | int ret; |
92 | if( ret = DYNLOAD getaddrinfo( sAddr.getStr(), ibuf, &aiHints, &pAddr ) | 92 | if( (ret = DYNLOAD getaddrinfo( |
93 | != 0 ) | 93 | sAddr.getStr(), ibuf, &aiHints, &pAddr )) != 0 ) |
94 | { | 94 | { |
95 | #ifdef WIN32 | 95 | #ifdef WIN32 |
96 | throw Bu::SocketException("Couldn't resolve hostname %s (%d).\n", | 96 | throw Bu::SocketException("Couldn't resolve hostname %s (%d).\n", |
diff --git a/src/tafnode.cpp b/src/tafnode.cpp index 829a8e1..09fc21b 100644 --- a/src/tafnode.cpp +++ b/src/tafnode.cpp | |||
@@ -111,7 +111,13 @@ bool Bu::TafGroup::hasChild( const Bu::FString &sName ) const | |||
111 | 111 | ||
112 | const Bu::TafGroup::GroupList &Bu::TafGroup::getChildren( const Bu::FString &sName ) const | 112 | const Bu::TafGroup::GroupList &Bu::TafGroup::getChildren( const Bu::FString &sName ) const |
113 | { | 113 | { |
114 | return hChildren.get( sName ); | 114 | try { |
115 | return hChildren.get( sName ); | ||
116 | } catch( Bu::HashException &e ) | ||
117 | { | ||
118 | throw Bu::TafException("No children of group \"%s\" match \"%s\".", | ||
119 | this->sName.getStr(), sName.getStr() ); | ||
120 | } | ||
115 | } | 121 | } |
116 | 122 | ||
117 | const Bu::TafGroup::NodeList &Bu::TafGroup::getChildren() const | 123 | const Bu::TafGroup::NodeList &Bu::TafGroup::getChildren() const |
@@ -121,7 +127,13 @@ const Bu::TafGroup::NodeList &Bu::TafGroup::getChildren() const | |||
121 | 127 | ||
122 | const Bu::TafGroup *Bu::TafGroup::getChild( const Bu::FString &sName ) const | 128 | const Bu::TafGroup *Bu::TafGroup::getChild( const Bu::FString &sName ) const |
123 | { | 129 | { |
124 | return hChildren.get( sName ).first(); | 130 | try { |
131 | return hChildren.get( sName ).first(); | ||
132 | } catch( Bu::HashException &e ) | ||
133 | { | ||
134 | throw Bu::TafException("No children of group \"%s\" match \"%s\".", | ||
135 | this->sName.getStr(), sName.getStr() ); | ||
136 | } | ||
125 | } | 137 | } |
126 | 138 | ||
127 | bool Bu::TafGroup::hasProperty( const Bu::FString &sName ) const | 139 | bool Bu::TafGroup::hasProperty( const Bu::FString &sName ) const |
@@ -131,12 +143,24 @@ bool Bu::TafGroup::hasProperty( const Bu::FString &sName ) const | |||
131 | 143 | ||
132 | const Bu::TafGroup::PropList &Bu::TafGroup::getProperties( const Bu::FString &sName ) const | 144 | const Bu::TafGroup::PropList &Bu::TafGroup::getProperties( const Bu::FString &sName ) const |
133 | { | 145 | { |
134 | return hProp.get( sName ); | 146 | try { |
147 | return hProp.get( sName ); | ||
148 | } catch( Bu::HashException &e ) | ||
149 | { | ||
150 | throw Bu::TafException("No properties of group \"%s\" match \"%s\".", | ||
151 | this->sName.getStr(), sName.getStr() ); | ||
152 | } | ||
135 | } | 153 | } |
136 | 154 | ||
137 | const Bu::FString &Bu::TafGroup::getProperty( const Bu::FString &sName ) const | 155 | const Bu::FString &Bu::TafGroup::getProperty( const Bu::FString &sName ) const |
138 | { | 156 | { |
139 | return hProp.get( sName ).first(); | 157 | try { |
158 | return hProp.get( sName ).first(); | ||
159 | } catch( Bu::HashException &e ) | ||
160 | { | ||
161 | throw Bu::TafException("No properties of group \"%s\" match \"%s\".", | ||
162 | this->sName.getStr(), sName.getStr() ); | ||
163 | } | ||
140 | } | 164 | } |
141 | 165 | ||
142 | const Bu::FString &Bu::TafGroup::getProperty( const Bu::FString &sName, | 166 | const Bu::FString &Bu::TafGroup::getProperty( const Bu::FString &sName, |