Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: More useful error messages  (Read 628 times)

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
More useful error messages
« on: September 09, 2022, 08:25:28 AM »

(only one error message of concern right now, if I run into any more errors that could be improved I'll make further posts in this thread)

Missing file
So when the game looks for an image file and can't find it, it generates an error like this (actual example I just had to work with):

Spoiler
Code
Error loading [graphics/weapons/Claris CN/pd_claris_cn_hardpoint_recoil.png] resource, not found in [/home/helena/Desktop/Stuff/Games/starsector/./mods/Adjusted Sector v0.4.2,/home/helena/Desktop/Stuff/Games/starsector/./mods/Arsenal Expansion 1.5.4a,/home/helena/Desktop/Stuff/Games/starsector/./mods/Better Colonies,/home/helena/Desktop/Stuff/Games/starsector/./mods/CaptainsLog,/home/helena/Desktop/Stuff/Games/starsector/./mods/Combat Alarm Sounds,/home/helena/Desktop/Stuff/Games/starsector/./mods/Combat Chatter,/home/helena/Desktop/Stuff/Games/starsector/./mods/Console Commands,/home/helena/Desktop/Stuff/Games/starsector/./mods/DIYPlanets,/home/helena/Desktop/Stuff/Games/starsector/./mods/Deluxe Player Flags,/home/helena/Desktop/Stuff/Games/starsector/./mods/ExtraSystemReloaded-master-v1.0.1,/home/helena/Desktop/Stuff/Games/starsector/./mods/fluffShipPack,/home/helena/Desktop/Stuff/Games/starsector/./mods/Fuel Siphoning,/home/helena/Desktop/Stuff/Games/starsector/./mods/Grand.Colonies1.0.d,/home/helena/Desktop/Stuff/Games/starsector/./mods/HMI,/home/helena/Desktop/Stuff/Games/starsector/./mods/Hegemony Expeditionary Auxiliary,/home/helena/Desktop/Stuff/Games/starsector/./mods/HTE,/home/helena/Desktop/Stuff/Games/starsector/./mods/Industrial.Evolution3.0.e,/home/helena/Desktop/Stuff/Games/starsector/./mods/Iron Shell,/home/helena/Desktop/Stuff/Games/starsector/./mods/LTA,/home/helena/Desktop/Stuff/Games/starsector/./mods/LazyLib,/home/helena/Desktop/Stuff/Games/starsector/./mods/Luddic_Enhancement,/home/helena/Desktop/Stuff/Games/starsector/./mods/MagicLib,/home/helena/Desktop/Stuff/Games/starsector/./mods/MakeParagonGreatAgain,/home/helena/Desktop/Stuff/Games/starsector/./mods/Nexerelin,/home/helena/Desktop/Stuff/Games/starsector/./mods/Progressive S-Mods,/home/helena/Desktop/Stuff/Games/starsector/./mods/Shielded Holds For All,/home/helena/Desktop/Stuff/Games/starsector/./mods/ShipDirectionMarker,/home/helena/Desktop/Stuff/Games/starsector/./mods/Ship and Weapon Pack,/home/helena/Desktop/Stuff/Games/starsector/./mods/SpeedUp,/home/helena/Desktop/Stuff/Games/starsector/./mods/Starship Legends,/home/helena/Desktop/Stuff/Games/starsector/./mods/stelnet,/home/helena/Desktop/Stuff/Games/starsector/./mods/Stop Gap Measure 1.2.2,/home/helena/Desktop/Stuff/Games/starsector/./mods/Superweapons Arsenal,/home/helena/Desktop/Stuff/Games/starsector/./mods/tahlan-shipworks,/home/helena/Desktop/Stuff/Games/starsector/./mods/Terraforming and Station Construction,/home/helena/Desktop/Stuff/Games/starsector/./mods/FED,/home/helena/Desktop/Stuff/Games/starsector/./mods/transpoffder,/home/helena/Desktop/Stuff/Games/starsector/./mods/UAF,/home/helena/Desktop/Stuff/Games/starsector/./mods/UnknownSkies,/home/helena/Desktop/Stuff/Games/starsector/./mods/WhichMod,/home/helena/Desktop/Stuff/Games/starsector/./mods/GraphicsLib,../starfarer.res/res,CLASSPATH]
[close]
The entire not found list is just a list of the directories of each mod, information which is available elsewhere in the log. As such, its main function is to confuse the user as to what is going on (why is it looking in all these folders?)

More useful would be to say what file, from which mod, was looking for that image (a .ship file? a .csv? settings.json?). Also maybe some OS-specific advice, i.e. if the user is on Linux mention case sensitivity.

(Also maybe it should write a warning for mod devs on Windows if the case doesn't match, so we don't have to wait for some Linux user's game to explode. But what would be a good way to display warnings that only show for the dev of the relevant mod? Have an idea for this, might make a separate thread later)
« Last Edit: September 09, 2022, 08:27:33 AM by Histidine »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: More useful error messages
« Reply #1 on: September 09, 2022, 08:38:05 AM »

I get what you're saying! The problem is that at the point where the error is generated, the code doesn't have any of this information. It happens in the generic ResourceLocator which, given a resource path, looks through a bunch of folders/jars - in a specific order, based on the mod order etc - and gives you an InputStream for the first copy of that file that it finds.

Refactoring to pass this information along to every call to open a resource... I guess that's possible, but it'd be a pretty sizeable undertaking.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: More useful error messages
« Reply #2 on: September 09, 2022, 08:56:13 AM »

Fair, but could it be made to just not print the list of mod directories? I don't think most users understand what it means for them.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: More useful error messages
« Reply #3 on: September 09, 2022, 09:04:22 AM »

Hmm - I feel like that message is more for a mod dev than the player, anyway, right? If there's a missing image there are *problems*. And while that info is available elsewhere in the log, often what you get is a copy-paste of the stack trace, so it seems useful to have that info there as well.

Put another way, I don't think the message sans the paths is going to help someone that doesn't already know what they're doing, and the paths don't hurt someone that does and might occasionally help. It's also an explicit confirmation that the game did actually look in those folders and that something didn't go wrong with the configuration of where it's supposed to look - that's actually the primary reason for that part of the message.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: More useful error messages
« Reply #4 on: December 19, 2022, 05:16:18 PM »

Thing I just thought of after looking at a recent bug report thread:

If loading a save fails for whatever reason, prompt to load the .bak backup if it exists.

(Also see this thread for a potential option to make the immediate error popup more informative)
...and on that note descriptor.xml still doesn't seem to have a version field that would allow the game to block loading saves from a too-old Starsector version?
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: More useful error messages
« Reply #5 on: February 03, 2024, 02:01:51 AM »

Someone's been having the 'File rename failed' issue when saving game (why does that happen?), suggested that the popup dialog notifying the player of this issue should require a confirmation rather than being 'click anywhere to dismiss'.
Logged