55from pathlib import Path
66
77from azlassets import __version__ , config , protobuf , versioncontrol , updater , repair , downloader
8- from azlassets .classes import Client
8+ from azlassets .classes import Client , UnknownVersionTypeError , VersionResult
99
1010
11+ def try_parse_version_string (vstring : str , skip_error : bool = False ) -> VersionResult :
12+ try :
13+ return versioncontrol .parse_version_string (vstring )
14+ except UnknownVersionTypeError as e :
15+ if skip_error :
16+ print (f"WARN: Unknown version type '{ e .version_name } ' cannot be processed, but this error has been skipped." )
17+ print ("WARN: Update application as soon as possible to support this missing version type." )
18+ else : raise
19+
1120async def execute (args ):
1221 # load config data from files
1322 userconfig = config .load_user_config ()
@@ -31,7 +40,7 @@ async def execute(args):
3140 sys .exit (1 )
3241
3342 version_string = version_response .pb .version
34- versionlist = [versioncontrol . parse_version_string ( v ) for v in version_string if v .startswith ("$" )]
43+ versionlist = [try_parse_version_string ( v , args . skip_unknown_version_error ) for v in version_string if v .startswith ("$" )]
3544
3645 async with downloader .AzurlaneAsyncDownloader (clientconfig .cdnurl , useragent = userconfig .useragent ) as downloader_session :
3746 for vresult in versionlist :
@@ -71,6 +80,8 @@ def main():
7180 help = "Checks if all files are correct using the local hash file." )
7281 parser .add_argument ("--ignore-hashfile" , default = False , action = argparse .BooleanOptionalAction ,
7382 help = "Ignores the local hashfile and downloads ALL files again. This is only intended for testing purposes." )
83+ parser .add_argument ("--skip-unknown-version-error" , default = False , action = argparse .BooleanOptionalAction ,
84+ help = "Skips the UnknownVersionTypeError termination as a temporary fix if a new version type gets added." )
7485 args = parser .parse_args ()
7586
7687 args .client = Client [args .client ]
0 commit comments