Skip to content

Commit

Permalink
log the file causing the problem when an initializer is not a class
Browse files Browse the repository at this point in the history
  • Loading branch information
evantahler committed Oct 18, 2017
1 parent 300bc49 commit f52ffdb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions classes/process.js
Expand Up @@ -61,7 +61,14 @@ module.exports = class Process {
].forEach(async (file) => {
delete require.cache[require.resolve(file)]
const InitializerClass = require(file)
const initializer = new InitializerClass()
let initializer

try {
initializer = new InitializerClass()
} catch (error) {
this.fatalError(error, file)
}

try {
initializer.validate()
await initializer.initialize(api)
Expand Down Expand Up @@ -97,7 +104,13 @@ module.exports = class Process {

delete require.cache[require.resolve(file)]
const InitializerClass = require(file)
const initializer = new InitializerClass()
let initializer

try {
initializer = new InitializerClass()
} catch (error) {
this.fatalError(error, file)
}

// check if initializer already exists (exclude utils and config)
if (
Expand Down
2 changes: 1 addition & 1 deletion tutorials/running-actionhero.md
Expand Up @@ -140,7 +140,7 @@ ActionHero is not designed to function when installed globally. Do not install
"name": "my ActionHero project",
"scripts": {
"start" : "actionhero start",
"actionhero" : "actionhero",
"help" : "actionhero help",
"pretest": "standard",
"test" : "cross-env NODE_ENV=test mocha"
}
Expand Down

0 comments on commit f52ffdb

Please sign in to comment.