diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-06-09 19:05:21 -0400 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-06-11 11:01:06 -0400 |
commit | ff472101f41476ea53b13d554dff9249fa135406 (patch) | |
tree | 7eb24c73388cdd4ca5129ee1680b006ce0125cd9 /src/mongo/db/fts/fts_spec.cpp | |
parent | ad72bdb7555743edd6abdd6bcb1cf5ddf382ec83 (diff) | |
download | mongo-ff472101f41476ea53b13d554dff9249fa135406.tar.gz |
SERVER-18501: Improve error message when server fails to start due to unsupported text index language
Diffstat (limited to 'src/mongo/db/fts/fts_spec.cpp')
-rw-r--r-- | src/mongo/db/fts/fts_spec.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mongo/db/fts/fts_spec.cpp b/src/mongo/db/fts/fts_spec.cpp index 332d6d198e0..274d9a6d6ba 100644 --- a/src/mongo/db/fts/fts_spec.cpp +++ b/src/mongo/db/fts/fts_spec.cpp @@ -90,9 +90,17 @@ namespace mongo { // Initialize _defaultLanguage. Note that the FTSLanguage constructor requires // textIndexVersion, since language parsing is version-specific. - StatusWithFTSLanguage swl = - FTSLanguage::make( indexInfo["default_language"].String(), _textIndexVersion ); - verify( swl.getStatus().isOK() ); // should not fail, since validated by fixSpec(). + auto indexLanguage = indexInfo["default_language"].String(); + auto swl = FTSLanguage::make(indexLanguage , _textIndexVersion ); + + // This can fail if the user originally created the text index under an instance of + // MongoDB that supports different languages then the current instance + // TODO: consder propagating the index ns to here to improve the error message + uassert(28682, + str::stream() << "Unrecognized language " << indexLanguage << + " found for text index. Verify mongod was started with the" + " correct options.", + swl.getStatus().isOK()); _defaultLanguage = swl.getValue(); _languageOverrideField = indexInfo["language_override"].valuestrsafe(); |