warn instead of crashing when an app fails to load
This commit is contained in:
		
							parent
							
								
									e4a13a8b80
								
							
						
					
					
						commit
						233c6cd8ef
					
				| @ -68,7 +68,15 @@ require('ssl-root-cas') | |||||||
| function getAppContext(domaininfo) { | function getAppContext(domaininfo) { | ||||||
|   var localApp; |   var localApp; | ||||||
| 
 | 
 | ||||||
|   localApp = require(path.join(__dirname, 'vhosts', domaininfo.dirname, 'app.js')); |   try { | ||||||
|  |     localApp = require(path.join(__dirname, 'vhosts', domaininfo.dirname, 'app.js')); | ||||||
|  |   } catch(e) { | ||||||
|  |     console.error("[ERROR] could not load app.js for " + domaininfo.dirname); | ||||||
|  |     console.error(e); | ||||||
|  |     return PromiseA.resolve(connect().use('/', function (req, res) { | ||||||
|  |       res.end('{ "error": { "message": "could not load app.js for ' + domaininfo.dirname + '" } }'); | ||||||
|  |     })); | ||||||
|  |   } | ||||||
|   if (localApp.create) { |   if (localApp.create) { | ||||||
|     // TODO read local config.yml and pass it in
 |     // TODO read local config.yml and pass it in
 | ||||||
|     // TODO pass in websocket
 |     // TODO pass in websocket
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user