multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.3k stars 412 forks source link

Generic exception type for argument parser instead of std::invalid_argument #3493

Closed tederis closed 1 week ago

tederis commented 1 week ago

Currently the only exceptions that a Lua function can throw is std::invalid_argument. But sometimes this is not enough, because although we technically can use std::invalid_argument for different applications, it's better to use dedicated exceptions for their own purposes. std::invalid_argument - for invalid arguments, std::logic_error - for common cases. This PR also allows to create new exception types and use them with the argument parser.