@@ -213,18 +213,30 @@ def main():
213
213
errorFile .write (f"Validation Errors:\n { manifest .errors } " )
214
214
raise ValueError (f"Invalid manifest file: { manifest .errors } " )
215
215
216
- generateJsonFile (
217
- manifest = manifest ,
218
- addonPath = args .file ,
219
- parentDir = args .parentDir ,
220
- channel = args .channel ,
221
- publisher = args .publisher ,
222
- sourceUrl = args .sourceUrl ,
223
- url = args .url ,
224
- licenseName = args .licenseName ,
225
- # Convert the case --licUrl='' to --licUrl=None
226
- licenseUrl = args .licenseUrl if args .licenseUrl else None ,
227
- )
216
+ try :
217
+ generateJsonFile (
218
+ manifest = manifest ,
219
+ addonPath = args .file ,
220
+ parentDir = args .parentDir ,
221
+ channel = args .channel ,
222
+ publisher = args .publisher ,
223
+ sourceUrl = args .sourceUrl ,
224
+ url = args .url ,
225
+ licenseName = args .licenseName ,
226
+ # Convert the case --licUrl='' to --licUrl=None
227
+ licenseUrl = args .licenseUrl if args .licenseUrl else None ,
228
+ )
229
+ except Exception as e :
230
+ if manifest .errors :
231
+ if errorFilePath :
232
+ with open (errorFilePath , "w" ) as errorFile :
233
+ errorFile .write (f"Validation Errors:\n { manifest .errors } " )
234
+ raise ValueError (f"Invalid manifest file: { manifest .errors } " )
235
+ else :
236
+ if errorFilePath :
237
+ with open (errorFilePath , "w" ) as errorFile :
238
+ errorFile .write (f"Validation Errors:\n { e } " )
239
+ raise
228
240
229
241
230
242
if __name__ == '__main__' :
0 commit comments