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. */
| 408 | * error code is automatically added. |
| 409 | * Note that 's' must NOT end with \r\n. */ |
| 410 | void addReplyErrorLength(client *c, const char *s, size_t len) { |
| 411 | /* If the string already starts with "-..." then the error code |
| 412 | * is provided by the caller. Otherwise we use "-ERR". */ |
| 413 | if (!len || s[0] != '-') addReplyProto(c,"-ERR ",5); |
| 414 | addReplyProto(c,s,len); |
| 415 | addReplyProto(c,"\r\n",2); |
| 416 | } |
| 417 | |
| 418 | /* Do some actions after an error reply was sent (Log if needed, updates stats, etc.) */ |
| 419 | void afterErrorReply(client *c, const char *s, size_t len) { |
no test coverage detected