<div id="pagecontent">
<div class="index">
<!-- This is a (PRE) block. Make sure it's left aligned or your toc title will be off. -->
-<b>ReplyTypes: Contents</b><br> <a href="#Redis Reply Types">Redis Reply Types</a><br> <a href="#Status code reply">Status code reply</a><br> <a href="#Integer reply">Integer reply</a><br> <a href="#Bulk reply">Bulk reply</a><br> <a href="#Multi bulk reply">Multi bulk reply</a>
+<b>ReplyTypes: Contents</b><br> <a href="#Redis Reply Types">Redis Reply Types</a><br> <a href="#Status code reply">Status code reply</a><br> <a href="#Error reply">Error reply</a><br> <a href="#Integer reply">Integer reply</a><br> <a href="#Bulk reply">Bulk reply</a><br> <a href="#Multi bulk reply">Multi bulk reply</a>
</div>
<h1 class="wikiname">ReplyTypes</h1>
<div class="narrow">
<h1><a name="Redis Reply Types">Redis Reply Types</a></h1>Redis commands can reply to the client with four different kind of replies, you can find the protocol level specification of this replies in the <a href="ProtocolSpecification.html">Redis Protocol Specification</a>. This page is instead an higher level description of the four types of replies from the point of view of the final user.<h1><a name="Status code reply">Status code reply</a></h1>
-Status code replies are in the form of a <b>+OK</b> from the server, or a <b>-ERR</b> followed by an error string. At the protocol level this replies are sent as a single line. Client libraries should return <i>true</i> on <b>OK</b>, and should raise an exception in form of an error that stops the execution of the program on <b>ERR</b> replies from server, because this kind of replies are used by operations that usually fails because of a programming error, an inconsistent DB, and so on.<h1><a name="Integer reply">Integer reply</a></h1>
-At protocol level integer replies are single line replies in form of a decimal singed number. Redis commands returning <i>true</i> or <i>false</i> will use an integer reply and "1" and "0" as replies. A negative value in an integer reply is used to signal an error by all the commands, with the exception of <a href="IncrCommand.html">INCR</a>/<a href="IncrCommand.html">INCRBY</a>/<a href="IncrCommand.html">DECR</a>/<a href="IncrCommand.html">DECRBY</a> where negative return values are allowed (this command never fails).<br/><br/>All the integer replies using negative values to return errors will use the same values to signal the same errors:
-<b> -1 key not found
-</b> -2 key contains a value of the wrong type
-<b> -3 source object and destination object are the same
-</b> -4 out of range argument<br/><br/>Integer replies are usually passed by client libraries as integer values. On negative integer reply an exception should be raised (excluding the INCR family commands).<h1><a name="Bulk reply">Bulk reply</a></h1>
-A bulk reply is a binary-safe reply that is used to return a single string value (string is not limited to alphanumerical strings, it may contain binary data of any kind). Client libraries will usually return a string as return value of Redis commands returning bulk replies. There is a special bulk reply that signal that the element does not exist. When this happens the client library should return 'nil', 'false', or some other special element that can be distinguished by an empty string.<h1><a name="Multi bulk reply">Multi bulk reply</a></h1>
-While a bulk reply returns a single string value, multi bulk replies are used to return multiple values: lists, sets, and so on. Elements of a bulk reply can be missing (-1 length count at protocol level). Client libraries should return 'nil' or 'false' in order to make this elements distinguishable from empty strings. Client libraries should return multi bulk replies that are about ordered elements like list ranges as lists, and bulk replies about sets as hashes.
+Status code replies are single line strings having the <b>+</b> character as first byte. The string to return to the client is simply verything that follows the first <b>+</b> character. For example the <a href="PingCommand.html">PING</a> command returns <b>+PONG</b>, that is the string "PONG".<h1><a name="Error reply">Error reply</a></h1>
+This is like a status code reply but the first character is <b>-</b> instead of <b>+</b>. The client library should raise an error for error replies and stop the execution of the program if the exception is not trapped, showing the error message (everything following the first <b>-</b> character). An example of error is "-Error no such key" or "-foobar". Note that error replies will not collide with negative integer replies since integer replies are prefixed with the <b>:</b> character.<h1><a name="Integer reply">Integer reply</a></h1>
+At protocol level integer replies are single line replies in form of a decimal singed number prefixed by a <b>:</b> character. For example <b>:10</b> is an integer reply. Redis commands returning <i>true</i> or <i>false</i> will use an integer reply with 0 or 1 as values where 0 is false and 1 is true.<br/><br/>Integer replies are usually passed by client libraries as integer values.<h1><a name="Bulk reply">Bulk reply</a></h1>
+A bulk reply is a binary-safe reply that is used to return a binary safe single string value (string is not limited to alphanumerical strings, it may contain binary data of any kind). Client libraries will usually return a string as return value of Redis commands returning bulk replies. There is a special bulk reply that signal that the element does not exist. When this happens the client library should return 'nil', 'false', or some other special element that can be distinguished by an empty string.<h1><a name="Multi bulk reply">Multi bulk reply</a></h1>
+While a bulk reply returns a single string value, multi bulk replies are used to return multiple values: lists, sets, and so on. Elements of a bulk reply can be missing. Client libraries should return 'nil' or 'false' in order to make this elements distinguishable from empty strings. Client libraries should return multi bulk replies that are about ordered elements like list ranges as lists, and bulk replies about sets as hashes or Sets if the implementation language has a Set type.
+
</div>
</div>