hubot-archive / hubot-pugme

Pugme is the most important hubot script
22 stars 45 forks source link

Add checks of HTTP response code #5

Open radeksimko opened 8 years ago

radeksimko commented 8 years ago

The pugme service is currently down, which causes the pug commands to be ignored from user's point of view.

In reality an error is raised:

[Thu Jun 09 2016 18:36:55 GMT+0000 (UTC)] ERROR SyntaxError: Unexpected token <
 at Object.parse (native)
 at /workdir/node_modules/hubot-pugme/src/pugme.coffee:19:9, <js>:5:30
 at IncomingMessage.<anonymous> (/workdir/node_modules/scoped-http-client/src/index.js:95:22)
 at emitNone (events.js:72:20)
 at IncomingMessage.emit (events.js:166:7)
 at endReadableNT (_stream_readable.js:905:12)
 at doNTCallback2 (node.js:452:9)
 at process._tickDomainCallback (node.js:407:17)

I believe there can be some simple http response code checks (probably code != 200) in place to make hubot return a reasonably nice error message to the user.