guibec / rpgcraft

RPGCraft - Minecraft / Terraria / RPGMaker mashup
MIT License
8 stars 2 forks source link

Add error handling for save/load #77

Open robinlavallee opened 5 years ago

robinlavallee commented 5 years ago

No error handling is done at all, plus it's only integrated in the Debug menu.

jstine35 commented 5 years ago

What sort of error handling is appropriate in this case? Is this just looking to throw basic error if general savedata is corrupted? Eg, wrap the whole thing in a catch block and translate it into a basic recoverable "savedata is corrupted" error?

robinlavallee commented 5 years ago

Yea. I was also thinking about permission issues, hard drive issues, network issues (if we make those save games online at some point). So yea, fail, save is corrupted. May want to think about a backup save too.

jstine35 commented 5 years ago

K most of those should be handled separately, from an architectural standpoint. Some platforms and storage media have built in redundancy (Xbox) or make typical error checking difficult or ineffective (ps4). And cloud has a different ideal experience, since in that case a failure should re-download from online storage.

On pc people are pretty much expected to backup and restore manually. “Open explorer window here” is sufficient, especially if using proper non-exclusive D3D mode.

In none of these scenarios does the game’s internal save data APIs really need to care.

robinlavallee commented 5 years ago

Yes, except right now the save code doesn't even handle exceptions, so it will just silently fail. :P So at the very least, it needs to return true/false. ;)