MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / addReplyErrorLength

Function addReplyErrorLength

src/networking.cpp:530–536  ·  view source on GitHub ↗

Low level function called by the addReplyError...() functions. * It emits the protocol for a Redis error, in the form: * * -ERRORCODE Error Message * * If the error code is already passed in the string 's', the error * code provided is used, otherwise the string "-ERR " for the generic * error code is automatically added. * Note that 's' must NOT end with \r\n. */

Source from the content-addressed store, hash-verified

528 * error code is automatically added.
529 * Note that 's' must NOT end with \r\n. */
530void addReplyErrorLength(client *c, const char *s, size_t len) {
531 /* If the string already starts with "-..." then the error code
532 * is provided by the caller. Otherwise we use "-ERR". */
533 if (!len || s[0] != '-') addReplyProto(c,"-ERR ",5);
534 addReplyProto(c,s,len);
535 addReplyProto(c,"\r\n",2);
536}
537
538/* Do some actions after an error reply was sent (Log if needed, updates stats, etc.) */
539void afterErrorReply(client *c, const char *s, size_t len, int severity = ERR_CRITICAL) {

Callers 3

addReplyErrorFunction · 0.85
addReplyErrorSdsFunction · 0.85
addReplyErrorFormatFunction · 0.85

Calls 1

addReplyProtoFunction · 0.85

Tested by

no test coverage detected