Skip to content

Instantly share code, notes, and snippets.

@booo
Created August 31, 2011 10:32
Show Gist options
  • Select an option

  • Save booo/1183264 to your computer and use it in GitHub Desktop.

Select an option

Save booo/1183264 to your computer and use it in GitHub Desktop.
redis error handling
pg = require "pg"
http = require "http"
redis = require "redis"
rclient = redis.createClient()
rclient.on "error", (error) ->
console.log error
(http.createServer (req, res) ->
setTimeout ->
console.log "Trying to get value for key"
rclient.get "akey", (error, result) ->
"redis command executed..."
if error
res.writeHead 500
res.end error
else
res.writeHead 200
res.end result
, 1000*15
).listen 1337
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment