catch more error cases
This commit is contained in:
		
							父節點
							
								
									e7d0769270
								
							
						
					
					
						當前提交
						c704eda6b6
					
				@ -87,6 +87,11 @@ module.exports.create = function (securePort, certsPath, vhostsdir) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
          console.log('[log] LOADING "' + domaininfo.hostname + '/' + domaininfo.pathname + '"');
 | 
					          console.log('[log] LOADING "' + domaininfo.hostname + '/' + domaininfo.pathname + '"');
 | 
				
			||||||
          getAppContext(domaininfo).then(function (localApp) {
 | 
					          getAppContext(domaininfo).then(function (localApp) {
 | 
				
			||||||
 | 
					            //if (localApp.arity >= 2) { /* connect uses .apply(null, arguments)*/ }
 | 
				
			||||||
 | 
					            if ('function' !== typeof localApp) {
 | 
				
			||||||
 | 
					              localApp = getDummyAppContext(null, "[ERROR] no connect-style export from " + domaininfo.dirname);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Note: pathname should NEVER have a leading '/' on its own
 | 
					            // Note: pathname should NEVER have a leading '/' on its own
 | 
				
			||||||
            // we always add it explicitly
 | 
					            // we always add it explicitly
 | 
				
			||||||
            try {
 | 
					            try {
 | 
				
			||||||
@ -156,10 +161,12 @@ module.exports.create = function (securePort, certsPath, vhostsdir) {
 | 
				
			|||||||
            , port: securePort
 | 
					            , port: securePort
 | 
				
			||||||
            , url: domaininfo.pathname
 | 
					            , url: domaininfo.pathname
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!localApp) {
 | 
					            if (!localApp) {
 | 
				
			||||||
              return getDummyAppContext(null, "[ERROR] no app was returned by app.js for " + domaininfo.driname);
 | 
					              localApp = getDummyAppContext(null, "[ERROR] no app was returned by app.js for " + domaininfo.dirname);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          if (!localApp.then) {
 | 
					          if (!localApp.then) {
 | 
				
			||||||
            localApp = PromiseA.resolve(localApp);
 | 
					            localApp = PromiseA.resolve(localApp);
 | 
				
			||||||
          } else {
 | 
					          } else {
 | 
				
			||||||
@ -170,8 +177,6 @@ module.exports.create = function (securePort, certsPath, vhostsdir) {
 | 
				
			|||||||
        } catch(e) {
 | 
					        } catch(e) {
 | 
				
			||||||
          localApp = getDummyAppContext(e, "[ERROR] could not load app.js for " + domaininfo.dirname);
 | 
					          localApp = getDummyAppContext(e, "[ERROR] could not load app.js for " + domaininfo.dirname);
 | 
				
			||||||
          localApp = PromiseA.resolve(localApp);
 | 
					          localApp = PromiseA.resolve(localApp);
 | 
				
			||||||
 | 
					 | 
				
			||||||
          return localApp;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return localApp;
 | 
					        return localApp;
 | 
				
			||||||
 | 
				
			|||||||
		載入中…
	
	
			
			x
			
			
		
	
		新增問題並參考
	
	Block a user