minecraft-mod-manager
minecraft-mod-manager copied to clipboard
Handle multiple mod versions (don't crash)
Problem
Currently if there are two or more mods with the same id the application will crash. The application can't add multiple mods with the same id to the database
Copied from #54
Traceback (most recent call last):
File "c:\python39\lib\site-packages\minecraft_mod_manager\gateways\sqlite.py", line 138, in insert_mod
self._connection.execute(
sqlite3.IntegrityError: UNIQUE constraint failed: mod.id
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Python39\Scripts\minecraft-mod-manager.exe\__main__.py", line 7, in <module>
File "c:\python39\lib\site-packages\minecraft_mod_manager\__main__.py", line 21, in main
repo = RepoImpl(jar_parser, sqlite, downloader)
File "c:\python39\lib\site-packages\minecraft_mod_manager\adapters\repo_impl.py", line 26, in __init__
self.mods = self.db.sync_with_dir(jar_parser.mods)
File "c:\python39\lib\site-packages\minecraft_mod_manager\gateways\sqlite.py", line 65, in sync_with_dir
self.insert_mod(mod)
File "c:\python39\lib\site-packages\minecraft_mod_manager\gateways\sqlite.py", line 151, in insert_mod
raise ModAlreadyExists(mod)
minecraft_mod_manager.core.errors.mod_already_exists.ModAlreadyExists: Mod architectury already found in the the db.
Possible solutions
- Only load the latest version
- Ask the user which version to keep (and ask if the other ones should be deleted)