isc::Exception(file, line, what) {}
};
+///
+/// \brief Base class for all sorts of text parse errors.
+///
+class DNSTextError : public isc::dns::Exception {
+public:
+ DNSTextError(const char* file, size_t line, const char* what) :
+ isc::dns::Exception(file, line, what) {}
+};
+
///
/// \brief Base class for name parser exceptions.
///
-class NameParserException : public isc::dns::Exception {
+class NameParserException : public DNSTextError {
public:
NameParserException(const char* file, size_t line, const char* what) :
- isc::dns::Exception(file, line, what) {}
+ DNSTextError(file, line, what) {}
};
class DNSProtocolError : public isc::dns::Exception {
isc_throw(MasterLoaderError, "Invalid RR data");
}
}
- } catch (const MasterLoaderError&) {
- // This is a hack. We exclude the MasterLoaderError from the
- // below case. Once we restrict the below to some smaller
- // exception, we should remove this.
- throw;
- } catch (const isc::Exception& e) {
- // TODO: Once we do #2518, catch only the DNSTextError here,
- // not isc::Exception. The rest should be just simply
- // propagated.
+ } catch (const isc::dns::DNSTextError& e) {
+ reportError(lexer_.getSourceName(), lexer_.getSourceLine(),
+ e.what());
+ eatUntilEOL(false);
+ } catch (const MasterLexer::ReadError& e) {
+ reportError(lexer_.getSourceName(), lexer_.getSourceLine(),
+ e.what());
+ eatUntilEOL(false);
+ } catch (const MasterLexer::LexerError& e) {
+ reportError(lexer_.getSourceName(), lexer_.getSourceLine(),
+ e.what());
+ eatUntilEOL(false);
+ } catch (const InternalException& e) {
reportError(lexer_.getSourceName(), lexer_.getSourceLine(),
e.what());
eatUntilEOL(false);
/// \brief A standard DNS module exception that is thrown if RDATA parser
/// encounters an invalid or inconsistent data length.
///
-class InvalidRdataLength : public isc::dns::Exception {
+class InvalidRdataLength : public DNSTextError {
public:
InvalidRdataLength(const char* file, size_t line, const char* what) :
- isc::dns::Exception(file, line, what) {}
+ DNSTextError(file, line, what) {}
};
///
/// \brief A standard DNS module exception that is thrown if RDATA parser
/// fails to recognize a given textual representation.
///
-class InvalidRdataText : public isc::dns::Exception {
+class InvalidRdataText : public DNSTextError {
public:
InvalidRdataText(const char* file, size_t line, const char* what) :
- isc::dns::Exception(file, line, what) {}
+ DNSTextError(file, line, what) {}
};
///
/// encounters a character-string (as defined in RFC1035) exceeding
/// the maximum allowable length (\c MAX_CHARSTRING_LEN).
///
-class CharStringTooLong : public isc::dns::Exception {
+class CharStringTooLong : public DNSTextError {
public:
CharStringTooLong(const char* file, size_t line, const char* what) :
- isc::dns::Exception(file, line, what) {}
+ DNSTextError(file, line, what) {}
};
// Forward declaration to define RdataPtr.
/// \brief A standard DNS module exception that is thrown if an RRClass object
/// is being constructed from an unrecognized string.
///
-class InvalidRRClass : public isc::dns::Exception {
+class InvalidRRClass : public DNSTextError {
public:
InvalidRRClass(const char* file, size_t line, const char* what) :
- isc::dns::Exception(file, line, what) {}
+ DNSTextError(file, line, what) {}
};
///
/// \brief A standard DNS module exception that is thrown if an RRTTL object
/// is being constructed from an unrecognized string.
///
-class InvalidRRTTL : public isc::dns::Exception {
+class InvalidRRTTL : public DNSTextError {
public:
InvalidRRTTL(const char* file, size_t line, const char* what) :
- isc::dns::Exception(file, line, what) {}
+ DNSTextError(file, line, what) {}
};
///
/// \brief A standard DNS module exception that is thrown if an RRType object
/// is being constructed from an unrecognized string.
///
-class InvalidRRType : public isc::dns::Exception {
+class InvalidRRType : public DNSTextError {
public:
InvalidRRType(const char* file, size_t line, const char* what) :
- isc::dns::Exception(file, line, what) {}
+ DNSTextError(file, line, what) {}
};
///