mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
slightly better error messages when reading an enum value fails: also report the default used
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1464 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -429,14 +429,20 @@ template <> void Reader::handle(FileName& f) {
|
||||
|
||||
// ----------------------------------------------------------------------------- : EnumReader
|
||||
|
||||
String EnumReader::notDoneErrorMessage() const {
|
||||
if (!first) throw InternalError(_("No first value in EnumReader"));
|
||||
return _ERROR_2_("unrecognized value", read, first);
|
||||
}
|
||||
|
||||
void EnumReader::warnIfNotDone(Reader* errors_to) {
|
||||
if (!done) {
|
||||
// warning: unknown value
|
||||
errors_to->warning(_ERROR_1_("unrecognized value", read));
|
||||
errors_to->warning(notDoneErrorMessage());
|
||||
}
|
||||
}
|
||||
|
||||
void EnumReader::errorIfNotDone() {
|
||||
if (!done) {
|
||||
throw ParseError(_ERROR_1_("unrecognized value", read));
|
||||
throw ParseError(notDoneErrorMessage());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user