mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Better reporting of project-not-found
This commit is contained in:
		| @@ -136,7 +136,7 @@ | |||||||
|                             "pull":"Project '"+msg.project+"' reloaded", |                             "pull":"Project '"+msg.project+"' reloaded", | ||||||
|                             "revert": "Project '"+msg.project+"' reloaded" |                             "revert": "Project '"+msg.project+"' reloaded" | ||||||
|                         }[msg.action]; |                         }[msg.action]; | ||||||
|                         RED.notify(message); |                         RED.notify("<p>"+message+"</p>"); | ||||||
|                         RED.sidebar.info.refresh() |                         RED.sidebar.info.refresh() | ||||||
|                     }); |                     }); | ||||||
|                 }); |                 }); | ||||||
| @@ -144,7 +144,8 @@ | |||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (msg.text) { |             if (msg.text) { | ||||||
|                 var text = RED._(msg.text,{default:msg.text}); |                 msg.default = msg.text; | ||||||
|  |                 var text = RED._(msg.text,msg); | ||||||
|                 var options = { |                 var options = { | ||||||
|                     type: msg.type, |                     type: msg.type, | ||||||
|                     fixed: msg.timeout === undefined, |                     fixed: msg.timeout === undefined, | ||||||
|   | |||||||
| @@ -92,7 +92,8 @@ | |||||||
|             "restartRequired": "Node-RED must be restarted to enable upgraded modules", |             "restartRequired": "Node-RED must be restarted to enable upgraded modules", | ||||||
|             "credentials_load_failed": "<p>Flows stopped as the credentials could not be decrypted.</p><p>The flow credential file is encrypted, but the project's encryption key is missing or invalid.</p>", |             "credentials_load_failed": "<p>Flows stopped as the credentials could not be decrypted.</p><p>The flow credential file is encrypted, but the project's encryption key is missing or invalid.</p>", | ||||||
|             "missing_flow_file": "<p>Project flow file not found.</p><p>The project is not configured with a flow file.</p>", |             "missing_flow_file": "<p>Project flow file not found.</p><p>The project is not configured with a flow file.</p>", | ||||||
|             "project_empty": "<p>The project is empty.</p><p>Do you want to create a default set of project files?<br/>Otherwise, you will have to manually add files to the project outside of the editor.</p>" |             "project_empty": "<p>The project is empty.</p><p>Do you want to create a default set of project files?<br/>Otherwise, you will have to manually add files to the project outside of the editor.</p>", | ||||||
|  |             "project_not_found": "<p>Project '__project__' not found.</p>" | ||||||
|         }, |         }, | ||||||
|  |  | ||||||
|         "error": "<strong>Error</strong>: __message__", |         "error": "<strong>Error</strong>: __message__", | ||||||
|   | |||||||
| @@ -143,6 +143,7 @@ | |||||||
|             "projects": { |             "projects": { | ||||||
|                 "changing-project": "Setting active project : __project__", |                 "changing-project": "Setting active project : __project__", | ||||||
|                 "active-project": "Active project : __project__", |                 "active-project": "Active project : __project__", | ||||||
|  |                 "project-not-found": "Project not found : __project__", | ||||||
|                 "no-active-project": "No active project : using default flows file", |                 "no-active-project": "No active project : using default flows file", | ||||||
|                 "disabled": "Projects disabled : editorTheme.projects.enabled=false", |                 "disabled": "Projects disabled : editorTheme.projects.enabled=false", | ||||||
|                 "disabledNoFlag": "Projects disabled : set editorTheme.projects.enabled=true to enable", |                 "disabledNoFlag": "Projects disabled : set editorTheme.projects.enabled=true to enable", | ||||||
|   | |||||||
| @@ -78,8 +78,12 @@ function loadFlows() { | |||||||
|         }); |         }); | ||||||
|     }).catch(function(err) { |     }).catch(function(err) { | ||||||
|         activeConfig = null; |         activeConfig = null; | ||||||
|         events.emit("runtime-event",{id:"runtime-state",payload:{type:"warning",error:err.code,text:"notification.warnings."+err.code},retain:true}); |         events.emit("runtime-event",{id:"runtime-state",payload:{type:"warning",error:err.code,project:err.project,text:"notification.warnings."+err.code},retain:true}); | ||||||
|         log.warn(log._("nodes.flows.error",{message:err.toString()})); |         if (err.code === "project_not_found") { | ||||||
|  |             log.warn(log._("storage.localfilesystem.projects.project-not-found",{project:err.project})); | ||||||
|  |         } else { | ||||||
|  |             log.warn(log._("nodes.flows.error",{message:err.toString()})); | ||||||
|  |         } | ||||||
|         throw err; |         throw err; | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -741,8 +741,9 @@ function checkProjectExists(project) { | |||||||
|     var projectPath = fspath.join(projectsDir,project); |     var projectPath = fspath.join(projectsDir,project); | ||||||
|     return fs.pathExists(projectPath).then(function(exists) { |     return fs.pathExists(projectPath).then(function(exists) { | ||||||
|         if (!exists) { |         if (!exists) { | ||||||
|             var e = new Error("NLS: project not found"); |             var e = new Error("Project not found: "+project); | ||||||
|             e.code = "project_not_found"; |             e.code = "project_not_found"; | ||||||
|  |             e.project = project; | ||||||
|             throw e; |             throw e; | ||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
|   | |||||||
| @@ -437,6 +437,8 @@ function getFlows() { | |||||||
|         initialFlowLoadComplete = true; |         initialFlowLoadComplete = true; | ||||||
|         log.info(log._("storage.localfilesystem.user-dir",{path:settings.userDir})); |         log.info(log._("storage.localfilesystem.user-dir",{path:settings.userDir})); | ||||||
|         if (activeProject) { |         if (activeProject) { | ||||||
|  |             // At this point activeProject will be a string, so go load it and | ||||||
|  |             // swap in an instance of Project | ||||||
|             return loadProject(activeProject).then(function() { |             return loadProject(activeProject).then(function() { | ||||||
|                 log.info(log._("storage.localfilesystem.projects.active-project",{project:activeProject.name||"none"})); |                 log.info(log._("storage.localfilesystem.projects.active-project",{project:activeProject.name||"none"})); | ||||||
|                 log.info(log._("storage.localfilesystem.flows-file",{path:flowsFullPath})); |                 log.info(log._("storage.localfilesystem.flows-file",{path:flowsFullPath})); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user