Fixed error messages grammar.

This commit is contained in:
Nick Shadrin
2017-09-12 21:14:40 +03:00
parent 541f738a7f
commit f3280c5dc9

View File

@@ -937,9 +937,9 @@ nxt_conf_json_parse(nxt_mp_t *mp, u_char *start, u_char *end,
if (nxt_slow_path(p == end)) { if (nxt_slow_path(p == end)) {
nxt_conf_json_parse_error(error, start, nxt_conf_json_parse_error(error, start,
"An empty JSON isn't allowed. It must be either literal " "An empty JSON payload isn't allowed. It must be either a literal "
"(null, true, or false), number, string (in double quotes \"\"), " "(null, true, or false), a number, a string (in double quotes "
"array (with brackets []), or object (with braces {})." "\"\"), an array (with brackets []), or an object (with braces {})."
); );
return NULL; return NULL;
@@ -956,7 +956,7 @@ nxt_conf_json_parse(nxt_mp_t *mp, u_char *start, u_char *end,
if (nxt_slow_path(p != end)) { if (nxt_slow_path(p != end)) {
nxt_conf_json_parse_error(error, p, nxt_conf_json_parse_error(error, p,
"Unexpected character after the end of valid JSON value." "Unexpected character after the end of a valid JSON value."
); );
return NULL; return NULL;
@@ -1074,9 +1074,9 @@ nxt_conf_json_parse_value(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
error: error:
nxt_conf_json_parse_error(error, start, nxt_conf_json_parse_error(error, start,
"A valid JSON value is expected here. It must be either literal " "A valid JSON value is expected here. It must be either a literal "
"(null, true, or false), number, string (in double quotes \"\"), " "(null, true, or false), a number, a string (in double quotes \"\"), "
"array (with brackets []), or object (with braces {})." "an array (with brackets []), or an object (with braces {})."
); );
return NULL; return NULL;
@@ -1122,8 +1122,8 @@ nxt_conf_json_parse_object(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
if (nxt_slow_path(p == end)) { if (nxt_slow_path(p == end)) {
nxt_conf_json_parse_error(error, p, nxt_conf_json_parse_error(error, p,
"Unexpected end of JSON. There's an object without closing " "Unexpected end of JSON payload. There's an object without "
"brace (})." "a closing brace (})."
); );
goto error; goto error;
@@ -1177,8 +1177,8 @@ nxt_conf_json_parse_object(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
if (nxt_slow_path(p == end)) { if (nxt_slow_path(p == end)) {
nxt_conf_json_parse_error(error, p, nxt_conf_json_parse_error(error, p,
"Unexpected end of JSON. There's an object member without " "Unexpected end of JSON payload. There's an object member "
"value." "without a value."
); );
goto error; goto error;
@@ -1187,8 +1187,8 @@ nxt_conf_json_parse_object(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
if (nxt_slow_path(*p != ':')) { if (nxt_slow_path(*p != ':')) {
nxt_conf_json_parse_error(error, p, nxt_conf_json_parse_error(error, p,
"A colon (:) is expected here. There must be a colon between " "A colon (:) is expected here. There must be a colon after "
"JSON member name and value." "a JSON member name."
); );
goto error; goto error;
@@ -1199,8 +1199,8 @@ nxt_conf_json_parse_object(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
if (nxt_slow_path(p == end)) { if (nxt_slow_path(p == end)) {
nxt_conf_json_parse_error(error, p, nxt_conf_json_parse_error(error, p,
"Unexpected end of JSON. There's an object member without " "Unexpected end of JSON payload. There's an object member "
"value." "without a value."
); );
goto error; goto error;
@@ -1217,8 +1217,8 @@ nxt_conf_json_parse_object(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
if (nxt_slow_path(p == end)) { if (nxt_slow_path(p == end)) {
nxt_conf_json_parse_error(error, p, nxt_conf_json_parse_error(error, p,
"Unexpected end of JSON. There's an object without closing " "Unexpected end of JSON payload. There's an object without "
"brace (})." "a closing brace (})."
); );
goto error; goto error;
@@ -1230,9 +1230,9 @@ nxt_conf_json_parse_object(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
} }
nxt_conf_json_parse_error(error, p, nxt_conf_json_parse_error(error, p,
"Either a closing brace (}) or a comma (,) is expected here. " "Either a closing brace (}) or a comma (,) is expected here. "
"In JSON, all object members must be enclosed in braces and " "Each JSON object must be enclosed in braces and its members "
"separated by commas." "must be separated by commas."
); );
goto error; goto error;
@@ -1351,8 +1351,8 @@ nxt_conf_json_parse_array(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
if (nxt_slow_path(p == end)) { if (nxt_slow_path(p == end)) {
nxt_conf_json_parse_error(error, p, nxt_conf_json_parse_error(error, p,
"Unexpected end of JSON. There's an array without closing " "Unexpected end of JSON payload. There's an array without "
"bracket (])." "a closing bracket (])."
); );
goto error; goto error;
@@ -1380,8 +1380,8 @@ nxt_conf_json_parse_array(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
if (nxt_slow_path(p == end)) { if (nxt_slow_path(p == end)) {
nxt_conf_json_parse_error(error, p, nxt_conf_json_parse_error(error, p,
"Unexpected end of JSON. There's an array without closing " "Unexpected end of JSON payload. There's an array without "
"bracket (])." "a closing bracket (])."
); );
goto error; goto error;
@@ -1393,9 +1393,9 @@ nxt_conf_json_parse_array(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
} }
nxt_conf_json_parse_error(error, p, nxt_conf_json_parse_error(error, p,
"Either a closing bracket (]) or a comma (,) is expected here. " "Either a closing bracket (]) or a comma (,) is expected "
"In JSON, all array members must be enclosed in brackets and " "here. Each array must be enclosed in brackets and its "
"separated by commas." "members must be separated by commas."
); );
goto error; goto error;
@@ -1472,8 +1472,8 @@ nxt_conf_json_parse_string(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
} }
nxt_conf_json_parse_error(error, p, nxt_conf_json_parse_error(error, p,
"Unexpected character in string. All control characters must " "Unexpected character. All control characters in a JSON "
"be escaped in JSON strings." "string must be escaped."
); );
return NULL; return NULL;
@@ -1507,9 +1507,8 @@ nxt_conf_json_parse_string(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
} }
nxt_conf_json_parse_error(error, p - 1, nxt_conf_json_parse_error(error, p - 1,
"Unexpected reverse solidus in string. Reverse solidus in " "Unexpected backslash. A literal backslash in a JSON string "
"JSON strings must be escaped with a second reverse solidus " "must be escaped with a second backslash (\\\\)."
"(\\\\)."
); );
return NULL; return NULL;
@@ -1528,9 +1527,9 @@ nxt_conf_json_parse_string(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
} }
nxt_conf_json_parse_error(error, p, nxt_conf_json_parse_error(error, p,
"Invalid escape sequence. In JSON, escape sequences start " "Invalid escape sequence. An escape sequence in a JSON "
"with a reverse solidus, followed by the lowercase letter u, " "string must start with a backslash, followed by the lowercase "
"followed by four hexadecimal digits (\\uXXXX)." "letter u, followed by four hexadecimal digits (\\uXXXX)."
); );
return NULL; return NULL;
@@ -1542,8 +1541,8 @@ nxt_conf_json_parse_string(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
if (nxt_slow_path(p == end)) { if (nxt_slow_path(p == end)) {
nxt_conf_json_parse_error(error, p, nxt_conf_json_parse_error(error, p,
"Unexpected end of JSON. There's a string without ending double " "Unexpected end of JSON payload. There's a string without "
"quote (\")." "a final double quote (\")."
); );
return NULL; return NULL;
@@ -1559,8 +1558,8 @@ nxt_conf_json_parse_string(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
if (nxt_slow_path(size > NXT_CONF_MAX_STRING)) { if (nxt_slow_path(size > NXT_CONF_MAX_STRING)) {
nxt_conf_json_parse_error(error, start, nxt_conf_json_parse_error(error, start,
"Too long string. Such a big JSON string values are not " "The string is too long. Such a long JSON string value "
"supported." "is not supported."
); );
return NULL; return NULL;
@@ -1644,9 +1643,8 @@ nxt_conf_json_parse_string(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
if (nxt_slow_path(utf < 0xdc00 || utf > 0xdfff)) { if (nxt_slow_path(utf < 0xdc00 || utf > 0xdfff)) {
nxt_conf_json_parse_error(error, p - 12, nxt_conf_json_parse_error(error, p - 12,
"Invalid JSON encoding sequence. There's a 12 bytes " "Invalid JSON encoding sequence. This 12-byte "
"sequence that composes an illegal UTF-16 surrogate " "sequence composes an illegal UTF-16 surrogate pair."
"pair."
); );
return NULL; return NULL;
@@ -1664,8 +1662,8 @@ nxt_conf_json_parse_string(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
if (utf > 0xdbff || p[0] != '\\' || p[1] != 'u') { if (utf > 0xdbff || p[0] != '\\' || p[1] != 'u') {
nxt_conf_json_parse_error(error, p - 6, nxt_conf_json_parse_error(error, p - 6,
"Invalid JSON encoding sequence. There's a 6 bytes " "Invalid JSON encoding sequence. This 6-byte sequence "
"sequence that doesn't represent a valid character." "does not represent a valid UTF character."
); );
return NULL; return NULL;
@@ -1733,8 +1731,8 @@ nxt_conf_json_parse_number(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
&& (integer > cutoff || ch > cutlim))) && (integer > cutoff || ch > cutlim)))
{ {
nxt_conf_json_parse_error(error, start, nxt_conf_json_parse_error(error, start,
"Too big integer. Such a big JSON integer values are not " "The integer is too large. Such a large JSON integer value "
"supported." "is not supported."
); );
return NULL; return NULL;
@@ -1746,7 +1744,8 @@ nxt_conf_json_parse_number(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
if (nxt_slow_path(p - start > 1 && *start == '0')) { if (nxt_slow_path(p - start > 1 && *start == '0')) {
nxt_conf_json_parse_error(error, start, nxt_conf_json_parse_error(error, start,
"Leading zeros are not allowed in JSON numbers." "The number is invalid. Leading zeros are not allowed in JSON "
"numbers."
); );
return NULL; return NULL;
@@ -1840,8 +1839,8 @@ nxt_conf_json_parse_number(nxt_mp_t *mp, nxt_conf_value_t *value, u_char *start,
#else #else
nxt_conf_json_parse_error(error, start, nxt_conf_json_parse_error(error, start,
"Invalid number. Only integer JSON numbers without fraction and " "The number is not an integer. JSON numbers with decimals and "
"exponent parts are supported." "exponents are not supported."
); );
#endif #endif