forked from MapComplete/MapComplete
		
	Better error handling
This commit is contained in:
		
							parent
							
								
									e5dbeee621
								
							
						
					
					
						commit
						ad3a776366
					
				
					 6 changed files with 106 additions and 78 deletions
				
			
		|  | @ -217,12 +217,17 @@ class MiscThemeChecks extends DesugaringStep<LayoutConfigJson>{ | |||
|      | ||||
|     convert(json: LayoutConfigJson, context: string): { result: LayoutConfigJson; errors?: string[]; warnings?: string[]; information?: string[] } { | ||||
|         const warnings = [] | ||||
|         const errors = [] | ||||
|         if(json.id !== "personal" && (json.layers === undefined || json.layers.length === 0)){ | ||||
|             errors.push("The theme "+json.id+" has no 'layers' defined ("+context+")") | ||||
|         } | ||||
|         if(json.socialImage === ""){ | ||||
|             warnings.push("Social image for theme "+json.id+" is the emtpy string") | ||||
|         } | ||||
|         return { | ||||
|             result :json, | ||||
|             warnings | ||||
|             warnings, | ||||
|             errors | ||||
|         }; | ||||
|     } | ||||
| } | ||||
|  | @ -231,8 +236,8 @@ export class PrevalidateTheme extends Fuse<LayoutConfigJson> { | |||
| 
 | ||||
|     constructor() { | ||||
|         super("Various consistency checks on the raw JSON", | ||||
|             new OverrideShadowingCheck(), | ||||
|             new MiscThemeChecks() | ||||
|             new MiscThemeChecks(), | ||||
|             new OverrideShadowingCheck() | ||||
|         ); | ||||
| 
 | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue