Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ add_option( "cxx-use-shell-environment", "use $CXX from shell for C++ compiler"
add_option( "ld", "linker to use" , 1 , True )
add_option( "c++11", "enable c++11 support (experimental)", 0, True )

add_option( "cpppath", "Include path if you have headers in a nonstandard directory" , 1 , True )
add_option( "libpath", "Library path if you have libraries in a nonstandard directory" , 1 , True )
add_option( "cpppath", "Include path if you have headers in a nonstandard directory" , 1 , False )
add_option( "libpath", "Library path if you have libraries in a nonstandard directory" , 1 , False )

add_option( "extrapath", "comma separated list of add'l paths (--extrapath /opt/foo/,/foo) static linking" , 1 , True )
add_option( "extrapathdyn", "comma separated list of add'l paths (--extrapath /opt/foo/,/foo) dynamic linking" , 1 , True )
add_option( "extralib", "comma separated list of libraries (--extralib js_static,readline" , 1 , True )
add_option( "extrapath", "comma separated list of add'l paths (--extrapath /opt/foo/,/foo) static linking" , 1 , False )
add_option( "extrapathdyn", "comma separated list of add'l paths (--extrapath /opt/foo/,/foo) dynamic linking" , 1 , False )
add_option( "extralib", "comma separated list of libraries (--extralib js_static,readline" , 1 , False )

add_option( "no-glibc-check" , "don't check for new versions of glibc" , 0 , False )

Expand Down
4 changes: 3 additions & 1 deletion src/mongo/base/error_codes.err
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ error_code("NoClientContext", 81)
error_code("NoProgressMade", 82)

# Non-sequential error codes (for compatibility only)
error_code("DuplicateKey", 11000)
error_code("NotMaster", 10107) #this comes from assert_util.h
error_code("DuplicateKey", 11000)
error_code("InterruptedAtShutdown", 11600)
error_code("Interrupted", 11601)
error_code("OutOfDiskSpace", 14031 )

error_class("NetworkError", ["HostUnreachable", "HostNotFound"])
error_class("Interruption", ["Interrupted", "InterruptedAtShutdown", "ExceededTimeLimit"])
31 changes: 18 additions & 13 deletions src/mongo/base/generate_error_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ def generate_error_class_predicate_definition(class_name, code_names):

#pragma once

#include <string>

#include "mongo/base/string_data.h"
#include "mongo/client/export_macros.h"

Expand All @@ -177,19 +179,19 @@ class MONGO_CLIENT_API ErrorCodes {
MaxError
};

static const char* errorString(Error err);
static std::string errorString(Error err);

/**
* Parse an Error from its "name". Returns UnknownError if "name" is unrecognized.
* Parses an Error from its "name". Returns UnknownError if "name" is unrecognized.
*
* NOTE: Also returns UnknownError for the string "UnknownError".
*/
static Error fromString(const StringData& name);

/**
* Parse an Error from its "code". Returns UnknownError if "code" is unrecognized.
*
* NOTE: Also returns UnknownError for the integer code for UnknownError.
* Casts an integer "code" to an Error. Unrecognized codes are preserved, meaning
* that the result of a call to fromInt() may not be one of the values in the
* Error enumeration.
*/
static Error fromInt(int code);

Expand Down Expand Up @@ -218,13 +220,16 @@ class MONGO_CLIENT_API ErrorCodes {

#include "mongo/base/error_codes.h"

#include <cstring>
#include <boost/static_assert.hpp>

#include "mongo/util/mongoutils/str.h"

namespace mongo {
const char* ErrorCodes::errorString(Error err) {

std::string ErrorCodes::errorString(Error err) {
switch (err) {
%(symbol_to_string_cases)s;
default: return "Unknown error code";
default: return mongoutils::str::stream() << "Location" << err;
}
}

Expand All @@ -234,14 +239,14 @@ class MONGO_CLIENT_API ErrorCodes {
}

ErrorCodes::Error ErrorCodes::fromInt(int code) {
switch (code) {
%(int_to_symbol_cases)s;
default:
return UnknownError;
}
return static_cast<Error>(code);
}

%(error_code_class_predicate_definitions)s

namespace {
BOOST_STATIC_ASSERT(sizeof(ErrorCodes::Error) == sizeof(int));
} // namespace
} // namespace mongo
'''

Expand Down
2 changes: 1 addition & 1 deletion src/mongo/base/status-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace mongo {
return _error ? _error->code : ErrorCodes::OK;
}

inline const char* Status::codeString() const {
inline std::string Status::codeString() const {
return ErrorCodes::errorString(code());
}

Expand Down
2 changes: 1 addition & 1 deletion src/mongo/base/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace mongo {

inline ErrorCodes::Error code() const;

inline const char* codeString() const;
inline std::string codeString() const;

inline std::string reason() const;

Expand Down
7 changes: 0 additions & 7 deletions src/mongo/util/assert_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ namespace mongo {
enum CommonErrorCodes {
OkCode = 0,
DatabaseDifferCaseCode = 13297 , // uassert( 13297 )
InterruptedAtShutdown = 11600 , // uassert( 11600 )
SendStaleConfigCode = 13388 , // uassert( 13388 )
RecvStaleConfigCode = 9996, // uassert( 9996 )
PrepareConfigsFailedCode = 13104, // uassert( 13104 )
Expand Down Expand Up @@ -144,12 +143,6 @@ namespace mongo {

virtual bool severe() const { return true; }
virtual bool isUserAssertion() const { return false; }

/* true if an interrupted exception - see KillCurrentOp */
bool interrupted() {
return _ei.code == InterruptedAtShutdown || _ei.code == 11601 ||
_ei.code == ErrorCodes::ExceededTimeLimit;
}
};

/* UserExceptions are valid errors that a user can cause, like out of disk space or duplicate key */
Expand Down
2 changes: 1 addition & 1 deletion src/mongo/util/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace mongo {
* 1.2.3-rc4-pre-
* If you really need to do something else you'll need to fix _versionArray()
*/
const char versionString[] = "2.6.0-rc0";
const char versionString[] = "2.6.0-rc1";

// See unit test for example outputs
BSONArray toVersionArray(const char* version){
Expand Down