Author Topic: Errors raised from data  (Read 2145 times)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,226
    • View Profile
    • http://www.titusgames.de
Errors raised from data
« on: 31 May 2016, 21:56:39 »
All errors raised by wrong data should be handled in a different way as they are not really a bug/crash/errors in the program itself.
This means, bugs in any kind of xmls, bugs about missing files and so on should NOT be handles as megaglest_runtime_errors with all sort of debug output and so on. This is just confusing and helps in no way neither the modder nor the engine developer ( you get error outputs like this: (http://pastebin.com/raw/PfnsEgkM)

These kind of data bugs should be reported on console only and should just tell the real error and maybe some more info like:
Code: [Select]
Message: Error no animations found for skill [charge_skill] for parentLoader [/home/tscharn/.megaglest/scenarios/the_seventh_element/megarealms/factions/tech/units/long_swordsman/long_swordsman.xml]
Or something similar output which maybe gives more info about the real reason in a stacked/multi line way like this:
Code: [Select]
Message: Error loading UnitType: /home/tscharn/.megaglest/scenarios/the_seventh_element/megarealms/factions/tech/units/long_swordsman/long_swordsman.xml
Message: Error no animations found for skill [charge_skill] for parentLoader [/home/tscharn/.megaglest/scenarios/the_seventh_element/megarealms/factions/tech/units/long_swordsman/long_swordsman.xml]

After this error is written to console, just exit the game. Errors I have in mind here are xml-parsing errors, model loading errors and so on, so the things that happen on game launch.
Only direct errors from data should be reported this way, this means scenarios which suddenly crash later while playing them should of course be reported as real exceptions.

Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Re: Errors raised from data
« Reply #1 on: 2 June 2016, 21:59:01 »
So that would make support a lot more difficult, since windows users never use console and never will. How would we tell them of a bad install missing language files or something like this (or permission cannot find certain files).


GunChleoc

  • Horseman
  • ****
  • Posts: 202
    • View Profile
    • Fòram na Gàidhlig
Re: Errors raised from data
« Reply #2 on: 4 June 2016, 12:17:04 »
Maybe a popup displaying the error, then after the user clicks OK, return to the main menu? Distinguishing the messages does make sense.

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,226
    • View Profile
    • http://www.titusgames.de
Re: Errors raised from data
« Reply #3 on: 6 June 2016, 12:39:09 »
A popup is critical because the game might be in a state were it cannot render anymore. But on the other hand we have this state already in those cases.
My idea was to write the error message to a file too and then exit the game. After this, an "error display program" is started which shows the error.
This can be done by starting MG inside a script and displays the error when the game process itself has ended.
Or if the MG process itself starts a new process which monitors the MG process and displays the error message form the file, once the process finished.
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

GunChleoc

  • Horseman
  • ****
  • Posts: 202
    • View Profile
    • Fòram na Gàidhlig
Re: Errors raised from data
« Reply #4 on: 6 June 2016, 12:59:13 »
Sounds like a good plan :)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,226
    • View Profile
    • http://www.titusgames.de
Re: Errors raised from data
« Reply #5 on: 21 November 2016, 22:09:58 »
More ideas:
Currently the error handling is based on megaglest_runtime_error , but all errors are megaglest_runtime_errors. I think things should be more specific so they can be handled differently.

My idea would be to start with an megaglest_xml_error which is derived from a megaglest_runtime_error. By this its still a megaglest_runtime_error and if I miss something while replacing we still have a proper error handling but we get the option to handle xml errors in a better way.
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,226
    • View Profile
    • http://www.titusgames.de
Re: Errors raised from data
« Reply #6 on: 23 November 2016, 10:07:33 »
If anyone is interested, please test current version, its not perfect yet, but its already much better now.

To test:
change some xml in the factions and so on to something faulty like missing tags and see what happens when the game starts.
Best is to start from console too to see the output there too.
« Last Edit: 23 November 2016, 12:03:52 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,226
    • View Profile
    • http://www.titusgames.de
Re: Errors raised from data
« Reply #7 on: 26 November 2016, 15:06:14 »
I checked in more changes which effect the scenario error handling and give much more useful error outputs. Please test and comment.
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

filux

  • MegaGlest Team
  • Draco Rider
  • ********
  • Posts: 310
  • was OpenSuse x64, is Debian testing x64
    • View Profile
Re: Errors raised from data
« Reply #8 on: 26 November 2016, 19:18:50 »
Not bad change :), but during my test with wrong name of unit for "create" I had to click for "Ok" 6 times and in the console I see same (quite long text) 6 times too :). It is possible to understand why I get 6 errors (same "create unit" in the loop for creation 6 units), but it would be really nasty if it would be a line inside a loop with e.g. 20-40 iterations :D (for what Imo is really high chance in some scenarios).

+ in this text I see many informations which are more or less informative but this line says me completely nothing:
Code: [Select]
LuaLine=12
instead of this ^ (or additionally) I would like to see line number (if it is possible) for scenario file where is the error (in my case it was line 32).

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,226
    • View Profile
    • http://www.titusgames.de
Re: Errors raised from data
« Reply #9 on: 27 November 2016, 00:49:00 »
yes thats true, but at the moment the luaLine is the line in the xml file reduced by the offset where xml code is written.

so if the first 24 lines are xml code and you get "Lualine=14" it means the error is in line 24+14=38. It was the best info I could give and in my opinion better than what we had before. I also moved all the lua error handlimg to one single place(method). By this a better output should be much more easy to handle if we can calculate a better "luaLine" output in the future.
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,226
    • View Profile
    • http://www.titusgames.de
Re: Errors raised from data
« Reply #10 on: 7 December 2016, 13:21:24 »
This should be done now, did I miss anything?
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,226
    • View Profile
    • http://www.titusgames.de
Re: Errors raised from data
« Reply #11 on: 20 February 2017, 16:13:44 »
looks like this is ok now
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

 

anything