Skip to content

Commit

Permalink
Exit on errors encountered while loadFile
Browse files Browse the repository at this point in the history
  • Loading branch information
technicalpickles committed Mar 10, 2013
1 parent bb00ac9 commit fc74231
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 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

4 comments on commit fc74231

@tombell
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this really be an exit as it's not a fatal error?

@atmos
Copy link
Contributor

@atmos atmos commented on fc74231 Mar 11, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm partial to this behavior. If you can read it and the script can't be parsed I don't want it to be silently ignored. No?

@technicalpickles
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error comes up if you load a file that doesn't exist, like listing something in hubot-scripts.json that doesn't exist. Either that's a misconfiguration should be fixed, and thus is fatal, or the file is missing and something else is jacked up, which is also fatal.

@atmos
Copy link
Contributor

@atmos atmos commented on fc74231 Mar 11, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.