summaryrefslogtreecommitdiff
path: root/src/mongo/db/fts/fts_spec.cpp
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-09 19:05:21 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-11 11:01:06 -0400
commitff472101f41476ea53b13d554dff9249fa135406 (patch)
tree7eb24c73388cdd4ca5129ee1680b006ce0125cd9 /src/mongo/db/fts/fts_spec.cpp
parentad72bdb7555743edd6abdd6bcb1cf5ddf382ec83 (diff)
downloadmongo-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.cpp14
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();