1
0
Fork 0

changed error message

This commit is contained in:
jsteemann 2015-12-15 13:13:31 +01:00
parent 72f2c4a80e
commit c043f9301c
7 changed files with 44 additions and 12 deletions

View File

@ -170,7 +170,7 @@ BOOST_AUTO_TEST_CASE (test_invalidAttributeAfterExpand) {
TRI_ParseAttributeString(input, result);
BOOST_FAIL("Expected the function to throw");
} catch (Exception& e) {
BOOST_CHECK_EQUAL(e.code(), TRI_ERROR_ARANGO_PARSER_FAILED);
BOOST_CHECK_EQUAL(e.code(), TRI_ERROR_ARANGO_ATTRIBUTE_PARSER_FAILED);
}
}
@ -186,7 +186,7 @@ BOOST_AUTO_TEST_CASE (test_nonClosingBracket) {
TRI_ParseAttributeString(input, result);
BOOST_FAIL("Expected the function to throw");
} catch (Exception& e) {
BOOST_CHECK_EQUAL(e.code(), TRI_ERROR_ARANGO_PARSER_FAILED);
BOOST_CHECK_EQUAL(e.code(), TRI_ERROR_ARANGO_ATTRIBUTE_PARSER_FAILED);
}
}
@ -202,7 +202,39 @@ BOOST_AUTO_TEST_CASE (test_nonClosingBracket2) {
TRI_ParseAttributeString(input, result);
BOOST_FAIL("Expected the function to throw");
} catch (Exception& e) {
BOOST_CHECK_EQUAL(e.code(), TRI_ERROR_ARANGO_PARSER_FAILED);
BOOST_CHECK_EQUAL(e.code(), TRI_ERROR_ARANGO_ATTRIBUTE_PARSER_FAILED);
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test_nonAsterisk
////////////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE (test_nonAsterisk) {
std::string input = "foo[0]";
std::vector<AttributeName> result;
try {
TRI_ParseAttributeString(input, result);
BOOST_FAIL("Expected the function to throw");
} catch (Exception& e) {
BOOST_CHECK_EQUAL(e.code(), TRI_ERROR_ARANGO_ATTRIBUTE_PARSER_FAILED);
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test_nonAsterisk
////////////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE (test_nonAsterisk2) {
std::string input = "foo[0].value";
std::vector<AttributeName> result;
try {
TRI_ParseAttributeString(input, result);
BOOST_FAIL("Expected the function to throw");
} catch (Exception& e) {
BOOST_CHECK_EQUAL(e.code(), TRI_ERROR_ARANGO_ATTRIBUTE_PARSER_FAILED);
}
}

View File

@ -89,7 +89,7 @@
"ERROR_ARANGO_COLLECTION_NOT_UNLOADED" : { "code" : 1217, "message" : "collection must be unloaded" },
"ERROR_ARANGO_COLLECTION_TYPE_INVALID" : { "code" : 1218, "message" : "collection type invalid" },
"ERROR_ARANGO_VALIDATION_FAILED" : { "code" : 1219, "message" : "validator failed" },
"ERROR_ARANGO_PARSER_FAILED" : { "code" : 1220, "message" : "parsing definition failed" },
"ERROR_ARANGO_ATTRIBUTE_PARSER_FAILED" : { "code" : 1220, "message" : "parsing attribute name definition failed" },
"ERROR_ARANGO_DOCUMENT_KEY_BAD" : { "code" : 1221, "message" : "illegal document key" },
"ERROR_ARANGO_DOCUMENT_KEY_UNEXPECTED" : { "code" : 1222, "message" : "unexpected document key" },
"ERROR_ARANGO_DATADIR_NOT_WRITABLE" : { "code" : 1224, "message" : "server database directory not writable" },

View File

@ -89,7 +89,7 @@
"ERROR_ARANGO_COLLECTION_NOT_UNLOADED" : { "code" : 1217, "message" : "collection must be unloaded" },
"ERROR_ARANGO_COLLECTION_TYPE_INVALID" : { "code" : 1218, "message" : "collection type invalid" },
"ERROR_ARANGO_VALIDATION_FAILED" : { "code" : 1219, "message" : "validator failed" },
"ERROR_ARANGO_PARSER_FAILED" : { "code" : 1220, "message" : "parsing definition failed" },
"ERROR_ARANGO_ATTRIBUTE_PARSER_FAILED" : { "code" : 1220, "message" : "parsing attribute name definition failed" },
"ERROR_ARANGO_DOCUMENT_KEY_BAD" : { "code" : 1221, "message" : "illegal document key" },
"ERROR_ARANGO_DOCUMENT_KEY_UNEXPECTED" : { "code" : 1222, "message" : "unexpected document key" },
"ERROR_ARANGO_DATADIR_NOT_WRITABLE" : { "code" : 1224, "message" : "server database directory not writable" },

View File

@ -94,7 +94,7 @@ void triagens::basics::TRI_ParseAttributeString (std::string const& input,
|| input[pos + 1] != '*'
|| input[pos + 2] != ']'
|| (length - pos > 3 && input[pos + 3] != '.')) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_PARSER_FAILED);
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_ATTRIBUTE_PARSER_FAILED);
}
result.emplace_back(input.substr(parsedUntil, pos - parsedUntil), true);
pos += 4;

View File

@ -109,7 +109,7 @@ ERROR_ARANGO_DOCUMENT_TOO_LARGE,1216,"document too large","Will be raised when t
ERROR_ARANGO_COLLECTION_NOT_UNLOADED,1217,"collection must be unloaded","Will be raised when a collection should be unloaded, but has a different status."
ERROR_ARANGO_COLLECTION_TYPE_INVALID,1218,"collection type invalid","Will be raised when an invalid collection type is used in a request."
ERROR_ARANGO_VALIDATION_FAILED,1219,"validator failed","Will be raised when the validation of an attribute of a structure failed."
ERROR_ARANGO_PARSER_FAILED,1220,"parsing definition failed","Will be raised when parsing an attribute name definition failed."
ERROR_ARANGO_ATTRIBUTE_PARSER_FAILED,1220,"parsing attribute name definition failed","Will be raised when parsing an attribute name definition failed."
ERROR_ARANGO_DOCUMENT_KEY_BAD,1221,"illegal document key","Will be raised when a document key is corrupt."
ERROR_ARANGO_DOCUMENT_KEY_UNEXPECTED,1222,"unexpected document key","Will be raised when a user-defined document key is supplied for collections with auto key generation."
ERROR_ARANGO_DATADIR_NOT_WRITABLE,1224,"server database directory not writable","Will be raised when the server's database directory is not writable for the current user."

View File

@ -85,7 +85,7 @@ void TRI_InitializeErrorMessages () {
REG_ERROR(ERROR_ARANGO_COLLECTION_NOT_UNLOADED, "collection must be unloaded");
REG_ERROR(ERROR_ARANGO_COLLECTION_TYPE_INVALID, "collection type invalid");
REG_ERROR(ERROR_ARANGO_VALIDATION_FAILED, "validator failed");
REG_ERROR(ERROR_ARANGO_PARSER_FAILED, "parsing definition failed");
REG_ERROR(ERROR_ARANGO_ATTRIBUTE_PARSER_FAILED, "parsing attribute name definition failed");
REG_ERROR(ERROR_ARANGO_DOCUMENT_KEY_BAD, "illegal document key");
REG_ERROR(ERROR_ARANGO_DOCUMENT_KEY_UNEXPECTED, "unexpected document key");
REG_ERROR(ERROR_ARANGO_DATADIR_NOT_WRITABLE, "server database directory not writable");

View File

@ -185,7 +185,7 @@
/// Will be raised when an invalid collection type is used in a request.
/// - 1219: @LIT{validator failed}
/// Will be raised when the validation of an attribute of a structure failed.
/// - 1220: @LIT{parsing definition failed}
/// - 1220: @LIT{parsing attribute name definition failed}
/// Will be raised when parsing an attribute name definition failed.
/// - 1221: @LIT{illegal document key}
/// Will be raised when a document key is corrupt.
@ -1478,14 +1478,14 @@ void TRI_InitializeErrorMessages ();
#define TRI_ERROR_ARANGO_VALIDATION_FAILED (1219)
////////////////////////////////////////////////////////////////////////////////
/// @brief 1220: ERROR_ARANGO_PARSER_FAILED
/// @brief 1220: ERROR_ARANGO_ATTRIBUTE_PARSER_FAILED
///
/// parsing definition failed
/// parsing attribute name definition failed
///
/// Will be raised when parsing an attribute name definition failed.
////////////////////////////////////////////////////////////////////////////////
#define TRI_ERROR_ARANGO_PARSER_FAILED (1220)
#define TRI_ERROR_ARANGO_ATTRIBUTE_PARSER_FAILED (1220)
////////////////////////////////////////////////////////////////////////////////
/// @brief 1221: ERROR_ARANGO_DOCUMENT_KEY_BAD