forked from MapComplete/MapComplete
		
	Fix(studio): add check for incorrect suggestions, fix incorrect suggestion which breaks setting a 'marker'
This commit is contained in:
		
							parent
							
								
									3bfdc1838c
								
							
						
					
					
						commit
						143dd70973
					
				
					 2 changed files with 19 additions and 4 deletions
				
			
		|  | @ -208,13 +208,27 @@ function extractHintsFrom( | |||
|             validators: Validators, | ||||
|             Constants: Constants, | ||||
|         }) | ||||
|         if (hints["suggestions"]?.indexOf(null) >= 0) { | ||||
|         const evaluatedSuggestions = hints["suggestions"] | ||||
| 
 | ||||
|         if (evaluatedSuggestions?.indexOf(null) >= 0) { | ||||
|             throw ( | ||||
|                 "A suggestion generated 'null' for " + | ||||
|                 path.join(".") + | ||||
|                 ". Check the docstring, specifically 'suggestions'. Pay attention to double commas" | ||||
|             ) | ||||
|         } | ||||
| 
 | ||||
|         console.log(evaluatedSuggestions) | ||||
|         for (const hintElement of evaluatedSuggestions ?? []) { | ||||
|             if (typeof hintElement === "string") { | ||||
|                 throw ( | ||||
|                     "A suggestion generated a string for " + | ||||
|                     path.join(".") + | ||||
|                     ". Remember that you should use {'if': 'value=[actual_value]', 'then': '[some explanation]'}" | ||||
|                 ) | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
|     return hints | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue