From: JINMEI Tatuya Date: Tue, 13 Nov 2012 21:12:20 +0000 (-0800) Subject: [master] Merge branch 'trac2372' X-Git-Tag: trac2487_base~1^2~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9a11ef62ae36d9d891e87ba792fa249ae82f0736;p=thirdparty%2Fkea.git [master] Merge branch 'trac2372' --- 9a11ef62ae36d9d891e87ba792fa249ae82f0736 diff --cc src/lib/dns/master_lexer.h index da6bb5dee2,0757df82a2..854d602e03 --- a/src/lib/dns/master_lexer.h +++ b/src/lib/dns/master_lexer.h @@@ -42,28 -45,8 +45,29 @@@ class State /// applications; it's mainly expected to be used within this library, /// specifically by the \c MasterLoader class and \c Rdata implementation /// classes. +/// +/// \note The error handling policy of this class is slightly different from +/// that of other classes of this library. We generally throw an exception +/// for an invalid input, whether it's more likely to be a program error or +/// a "user error", which means an invalid input that comes from outside of +/// the library. But, this class returns an error code for some certain +/// types of user errors instead of throwing an exception. Such cases include +/// a syntax error identified by the lexer or a misspelled file name that +/// causes a system error at the time of open. This is based on the assumption +/// that the main user of this class is a parser of master files, where +/// we want to give an option to ignore some non fatal errors and continue +/// the parsing. This will be useful if it just performs overall error +/// checks on a master file. When the (immediate) caller needs to do explicit +/// error handling, exceptions are not that a useful tool for error reporting +/// because we cannot separate the normal and error cases anyway, which would +/// be one major advantage when we use exceptions. And, exceptions are +/// generally more expensive, either when it happens or just by being able +/// to handle with \c try and \c catch (depending on the underlying +/// implementation of the exception handling). For these reasons, some of +/// this class does not throw for an error that would be reported as an +/// exception in other classes. class MasterLexer { + friend class master_lexer_internal::State; public: class Token; // we define it separately for better readability