Permalink
Browse files

#93 - cosmetic - unify "catch" statement

And always try to use "x" as a parameter.
  • Loading branch information...
1 parent 622896a commit b28bd760163f351e19a0a7df500204f3f902fd7a @majek majek committed Oct 30, 2012
Showing with 8 additions and 10 deletions.
  1. +2 −2 src/trans-jsonp.coffee
  2. +1 −1 src/trans-websocket.coffee
  3. +1 −1 src/trans-xhr.coffee
  4. +1 −1 src/transport.coffee
  5. +3 −5 src/webjs.coffee
View
@@ -50,7 +50,7 @@ exports.app =
if typeof query is 'string'
try
d = JSON.parse(query)
- catch e
+ catch x
throw {
status: 500
message: 'Broken JSON encoding.'
@@ -60,7 +60,7 @@ exports.app =
if typeof d is 'string' and d
try
d = JSON.parse(d)
- catch e
+ catch x
throw {
status: 500
message: 'Broken JSON encoding.'
@@ -91,7 +91,7 @@ class WebSocketReceiver extends transport.GenericReceiver
try
@ws.send(payload)
return true
- catch e
+ catch x
return false
didClose: ->
View
@@ -33,7 +33,7 @@ exports.app =
}
try
d = JSON.parse(data)
- catch e
+ catch x
throw {
status: 500
message: 'Broken JSON encoding.'
View
@@ -116,7 +116,7 @@ class Session
remoteAddress = socket.remoteAddress
remotePort = socket.remotePort
address = socket.address()
- catch e
+ catch x
# All-or-nothing
return
@connection.remoteAddress = remoteAddress
View
@@ -44,12 +44,10 @@ fake_response = (req, res) ->
r = r.concat(['', ''])
try
res.write(r.join('\r\n'))
- catch e
- null
+ catch x
try
res.end()
- catch e
- null
+ catch x
res.setHeader = (k, v) -> headers[k] = v
@@ -115,7 +113,7 @@ exports.GenericApp = class GenericApp
try
res.writeHead(500, {})
res.end("500 - Internal Server Error")
- catch y
+ catch x
@log('error', 'Exception on "'+ req.method + ' ' + req.href + '" in filter "' + req.last_fun + '":\n' + (x.stack || x))
return true

0 comments on commit b28bd76

Please sign in to comment.