0neGal / viper

Launcher+Updater for TF|2 Northstar
https://0negal.github.io/viper
GNU General Public License v3.0
151 stars 21 forks source link

bug: Improperly formatted mod causes uncaught errors in Viper #154

Closed GeckoEidechse closed 1 year ago

GeckoEidechse commented 1 year ago

Describe the bug Installing cceric-TF1_Imc_Pilot-1.0.0 with Viper causes it to throw errors as per user report on Northstar Discord

To Reproduce Steps to reproduce the behavior:

  1. Go to mod browser in Northstar and look for TF1_Imc_Pilot
  2. Install
  3. Error message as can seen below pops up.
  4. Clicking OK on the error message just causes a new one to pop up.

Expected behavior Viper should catch error caused by improperly formatted mod and handle it

Screenshots error message

discord messages

Link to messages in #modding-chat: https://discord.com/channels/920776187884732556/922663696273125387/1041336033700225154

Version: v1.6.2

Additional Info One needs to manually delete the mod via file explorer to resolve errors.

0neGal commented 1 year ago

An "Improperly formatted" toast should probably appear. As in, before moving the mod to your mods folder it should confirm the syntax of the JSON file and spit a reasonable error out.

However, I'm uncertain what would be most user-friendly, I am doubtful that, "Improperly formatted mod.json" is a good way to phrase it.

Is there a more friendly name for the mod.json file? I would say manifest would perhaps be good, but Thunderstore installed mods will come with the Thunderstore manifest file, so it would be confusing...

Either way I'll have a look at this ASAP, along with a few other things, then I'll be making a new release from there with the fix.

GeckoEidechse commented 1 year ago

Maybe something along the lines of

This mod is improperly formatted and therefore couldn't be installed.

and maybe some way of clicking a link or something to get more info if need be.

0neGal commented 1 year ago

I think simply having the entire error in the toast would be best, i.e the title of the toast being akin to "Failed to install mod", the description/text being " has an improperly formatted mod.json, this is the mod developer's fault."

Linking to external content seems a little unnecessary, especially if it can all be contained in the toast alone.

0neGal commented 1 year ago

The actual reasoning for why this happens is slightly more complicated than I thought initially, and whoever uploaded the mod in question, did not at all test it with any mod manager, and likely expected everybody to download and manually extract it.

Welp, now Viper is actually capable of handling it... Albeit, clumsily, but it's the best you can do when it's not formatted in the structure that it should be.

Only thing missing is the localization (#155), functionality wise it is in upstream.

GeckoEidechse commented 1 year ago

and whoever uploaded the mod in question, did not at all test it with any mod manager

Tbf, I don't think one can expect modders to test all mod-managers, though I do wish we had some way of verifying file structure to some degree on Thunderstore. Either way, best if mod-managers can handle faulty mods in the sense that it catches it and shows simple error message ^^

0neGal commented 1 year ago

Either way, best if mod-managers can handle faulty mods in the sense that it catches it and shows simple error message ^^

Exactly!