Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
808e43e1
Commit
808e43e1
authored
Nov 22, 2010
by
Pieter Noordhuis
Browse files
Update README with new way of handling errors
parent
56bbeb70
Changes
1
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
808e43e1
...
...
@@ -35,16 +35,17 @@ To consume the synchronous API, there are only a few function calls that need to
### Connecting
The function
`redisConnect`
is used to create a so-called
`redisContext`
. The context is where
Hiredis holds state for a connection. The
`redisContext`
struct has an
`error`
field that is
non-NULL when the connection is in an error state. It contains a string with a textual
representation of the error. After trying to connect to Redis using
`redisConnect`
you should
check the
`error`
field to see if establishing the connection was successful:
The function
`redisConnect`
is used to create a so-called
`redisContext`
. The
context is where Hiredis holds state for a connection. The
`redisContext`
struct has an integer
`err`
field that is non-zero when an the connection is in
an error state. The field
`errstr`
will contain a string with a description of
the error. After trying to connect to Redis using
`redisConnect`
you should
check the
`err`
field to see if establishing the connection was successful:
redisContext *c = redisConnect("127.0.0.1", 6379);
if (c->err
or != NULL
) {
printf("Error: %s\n", c->err
o
r);
// handle error
if (c->err) {
printf("Error: %s\n", c->err
st
r);
// handle error
}
### Sending commands
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment