summaryrefslogtreecommitdiffstats
path: root/src/lib/dns/master_lexer.cc
diff options
context:
space:
mode:
authorJINMEI Tatuya <jinmei@isc.org>2013-01-15 04:15:15 +0100
committerJINMEI Tatuya <jinmei@isc.org>2013-01-15 04:15:15 +0100
commitf45c804082f5ebfbe3339224083531fe86f2bfb2 (patch)
tree8bc24ee7f824687e2e8923b47ea8cc65229cdf0b /src/lib/dns/master_lexer.cc
parent[2572] avoid direct comparison between size_t and streampos (diff)
downloadkea-f45c804082f5ebfbe3339224083531fe86f2bfb2.tar.xz
kea-f45c804082f5ebfbe3339224083531fe86f2bfb2.zip
[2572] convert OpenError to Unexpected in the stream ver. of pushSource.
with the change for #2572 this version can now have this exception, and since it's intended to be hidden within the lexer and input source classes, we need to convert it. doc/tests are also added/updated.
Diffstat (limited to 'src/lib/dns/master_lexer.cc')
-rw-r--r--src/lib/dns/master_lexer.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/dns/master_lexer.cc b/src/lib/dns/master_lexer.cc
index 518bea3731..7febd5857e 100644
--- a/src/lib/dns/master_lexer.cc
+++ b/src/lib/dns/master_lexer.cc
@@ -144,7 +144,13 @@ MasterLexer::pushSource(const char* filename, std::string* error) {
void
MasterLexer::pushSource(std::istream& input) {
- impl_->sources_.push_back(InputSourcePtr(new InputSource(input)));
+ try {
+ impl_->sources_.push_back(InputSourcePtr(new InputSource(input)));
+ } catch (const InputSource::OpenError& ex) {
+ // Convert the "internal" exception to public one.
+ isc_throw(Unexpected, "Failed to push a stream to lexer: " <<
+ ex.what());
+ }
impl_->source_ = impl_->sources_.back().get();
impl_->has_previous_ = false;
impl_->last_was_eol_ = true;