ryobg / JContainers

JSON-based data structures for Papyrus - the TESV Skyrim SE scripting language
MIT License
107 stars 23 forks source link

Can better diagnostics be issued? #23

Closed ryobg closed 6 years ago

ryobg commented 6 years ago

An assert to trigger when loading invalid triggers: https://github.com/ryobg/JContainers/blob/5ae10d81e1bb3ea062c6cd9716d79bb41fca0b1f/src/JContainers/src/collections/collections.cpp#L76

ryobg commented 6 years ago

See also: https://forums.nexusmods.com/index.php?/topic/6560841-jcontainers-se/?p=59342601

SilverIce commented 6 years ago

The best way would be to replace assertion and throw some boost archive exception. instead. The archive is corrupted and there is nothing that can be done

ryobg commented 6 years ago

Yes, it may do. Not sure how exceptions are handled in that moment, but looking by your answer it should be fine.

SilverIce commented 6 years ago

The exception will be handled in the domain master. The cons is that the Skyrim won't crash and users will not know that JC data was not loaded (unless they read log files)

ryobg commented 6 years ago

Then maybe a combo of BOOST_ASSERT_MSG and throw would do.