Skip to content

Commit

Permalink
Merge pull request #432 from github/exit-on-errors
Browse files Browse the repository at this point in the history
Exit on errors during startup
  • Loading branch information
atmos committed Mar 10, 2013
2 parents 04dc820 + e21b01f commit fe6f26b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion bin/hubot
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ else
robot.loadHubotScripts scriptsPath, scripts
catch err
console.error "Error parsing JSON data from hubot-scripts.json: #{err}"
process.exit(1)

externalScripts = Path.resolve ".", "external-scripts.json"
Fs.exists externalScripts, (exists) ->
Expand All @@ -106,9 +107,10 @@ else
if data.length > 0
try
scripts = JSON.parse data
robot.loadExternalScripts scripts
catch err
console.error "Error parsing JSON data from external-scripts.json: #{err}"
process.exit(1)
robot.loadExternalScripts scripts

for path in Options.scripts
if path[0] == '/'
Expand Down
5 changes: 4 additions & 1 deletion src/robot.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ class Robot
require(full) @
@parseHelp "#{path}/#{file}"
catch error
@logger.error "Unable to load #{full}: #{error}\n#{error.stack}"
@logger.error "Unable to load #{full}: #{error.stack}"
process.exit(1)

# Public: Loads every script in the given path.
#
Expand Down Expand Up @@ -180,6 +181,7 @@ class Robot
require(pkg) @
catch error
@logger.error "Error loading scripts from npm package - #{error}"
process.exit(1)

# Setup the Connect server's defaults.
#
Expand Down Expand Up @@ -246,6 +248,7 @@ class Robot
@adapter = require(path).use @
catch err
@logger.error "Cannot load adapter #{adapter} - #{err}"
process.exit(1)

# Public: Help Commands for Running Scripts.
#
Expand Down

0 comments on commit fe6f26b

Please sign in to comment.