OutpostUniverse / OP2Utility

C++ library for working with Outpost 2 related files and tasks.
MIT License
4 stars 0 forks source link

Make map version check throw instead of log to cerr #240

Closed DanRStevens closed 5 years ago

DanRStevens commented 5 years ago

Parsing should stop when a bad version number is found, so throwing is more appropriate. It also allows the caller to control how and where output is displayed, which logging to cerr doesn't.

Added additional diagnostic output to error message.

This update relates to issue #239, but doesn't solve it. This change should be considered separate.

Brett208 commented 5 years ago

I thought you were against throwing an error for an incorrect version number which was why I left this as a cerr back in the day. I'm happy if an error is thrown.

-Brett

DanRStevens commented 5 years ago

You're probably right. I would prefer being able to load a map with an incorrect version and display a warning, though we have no proper mechanism to communicate warnings that allow the caller to choose how the warning is displayed.

I suppose one method is to not check during load, but rather to validate afterwards. That's a topic for another day though.

And I guess we don't really need to support maps with invalid version numbers at this point. We shouldn't encounter any in the wild.

Ehh, I guess I've changed my mind. ¯\_(ツ)_/¯