-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttpd.coffee
More file actions
36 lines (29 loc) · 1.03 KB
/
httpd.coffee
File metadata and controls
36 lines (29 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
spawn = require('child_process').spawn
module.exports = (robot) ->
robot.router.get "/exception_notification/test", (req, res) ->
envelope = room: '#infrastructure'
robot.send envelope, "ようこそ°˖✧◝(⁰▿⁰)◜✧˖°"
res.end 'success'
robot.router.post "/exception_notification/myapp", (req, res) ->
backtrace = req.body.exception.backtrace.slice(0, 4).join("\n")
message = """
Execption: #{req.body.server} - #{req.body.exception.error_class}
PATH: #{JSON.stringify req.body.environment.PATH_INFO}
-------------------------------
Backtrace:
-------------------------------
#{backtrace}
...
"""
payload =
message:
room: "#infrastructure"
content:
text: message
color: 'warning'
robot.emit "slack-attachment", payload
res.end 'success'
robot.router.get "/exception_notification/test", (req, res) ->
envelope = room: '#hubot-sandbox'
robot.send envelope, "ようこそ°˖✧◝(⁰▿⁰)◜✧˖°"
res.end 'success'